Olá alura,
estou tendo dificuldades para acessar a conexao com o mysql no docker. Estou usando o docker para fazer conexao com o mysql. A aplicação esta sendo feita no doctrine:
php bin/doctrine.php dbal:run-sql "SHOW TABLES"
[info] Connecting with parameters [array]
[debug] Executing statement: SHOW TABLES
In ExceptionConverter.php line 68:
An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1 near "SHOW": syntax error
In Exception.php line 24:
SQLSTATE[HY000]: General error: 1 near "SHOW": syntax error
In Connection.php line 27:
SQLSTATE[HY000]: General error: 1 near "SHOW": syntax error
dbal:run-sql [--connection CONNECTION] [--depth DEPTH] [--force-fetch] [--] <sql>
[info] Disconnecting
Eu conectei o mysql, atraves desse codigo:
docker exec -it contdb mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 9.3.0 MySQL Community Server - GPL
Copyright (c) 2000, 2025, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
Eu comecei a usar os codigos para manipular o banco, mas nao responde:
mysql> SHOW DATABASES
-> SELECT User,Host FROM mysql.user
-> SHOW DATABASES
-> php bin/doctrine.php dbal:run-sql "SHOW TABLES"
-> help
->