conexão recusada com mysql
Bom dia, Carlos, ao subir os container dá o sequinte erro:
SQLSTATE[HY000] [2002] Connection refused (SQL: select * from `permissions`)
e também não consigo conectar com o bando de dados, mas quando dou docker ps exibi o mysql em execução, o que será?
Boa tarde, Carlos, quando dou o comando docker ps o container do mysql está sendo executado, mas não aparece a porta, por gentileza, você tem uma ideia do que seja?
percebi que assim sobe o mysql reinicia e a porta não sobe novamente
Olá, Rafael!
Tudo bem?
Chegou a olhar os logs do container amigo?
docker logs container_id
Vou precisar dos detalhes dos logs para conseguir te ajudar a identificar o motivo do container não ficar on
Carlos, no meu pc pessoal apliquei no larafood e o mysql não caiu, mas continua dando o mesmo:
SQLSTATE[HY000] [2002] Connection refused (SQL: select * from `permissions`)
o log está retornando isto
2021-12-29T19:17:44.282609Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-12-29T19:17:44.285414Z 0 [Note] mysqld (mysqld 5.7.22) starting as process 1 ...
2021-12-29T19:17:44.293866Z 0 [Note] InnoDB: PUNCH HOLE support available
2021-12-29T19:17:44.293938Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-12-29T19:17:44.293948Z 0 [Note] InnoDB: Uses event mutexes
2021-12-29T19:17:44.293954Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2021-12-29T19:17:44.293959Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2021-12-29T19:17:44.293965Z 0 [Note] InnoDB: Using Linux native AIO
2021-12-29T19:17:44.294695Z 0 [Note] InnoDB: Number of pools: 1
2021-12-29T19:17:44.295045Z 0 [Note] InnoDB: Using CPU crc32 instructions
2021-12-29T19:17:44.326212Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2021-12-29T19:17:44.349385Z 0 [Note] InnoDB: Completed initialization of buffer pool
2021-12-29T19:17:44.354254Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2021-12-29T19:17:44.368532Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2021-12-29T19:17:44.381626Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-12-29T19:17:44.381817Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-12-29T19:17:44.389349Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2021-12-29T19:17:44.390926Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2021-12-29T19:17:44.391027Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2021-12-29T19:17:44.392388Z 0 [Note] InnoDB: 5.7.22 started; log sequence number 12359988
2021-12-29T19:17:44.392663Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2021-12-29T19:17:44.393064Z 0 [Note] Plugin 'FEDERATED' is disabled.
2021-12-29T19:17:44.404881Z 0 [Note] InnoDB: Buffer pool(s) load completed at 211229 19:17:44
2021-12-29T19:17:44.409605Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2021-12-29T19:17:44.410592Z 0 [Warning] CA certificate ca.pem is self signed.
2021-12-29T19:17:44.423686Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2021-12-29T19:17:44.423836Z 0 [Note] IPv6 is available.
2021-12-29T19:17:44.423855Z 0 [Note] - '::' resolves to '::';
2021-12-29T19:17:44.423876Z 0 [Note] Server socket created on IP: '::'.
2021-12-29T19:17:44.553929Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2021-12-29T19:17:44.555661Z 0 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2021-12-29T19:17:44.555741Z 0 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
2021-12-29T19:17:44.555757Z 0 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2021-12-29T19:17:44.555864Z 0 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
2021-12-29T19:17:44.555881Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2021-12-29T19:17:44.555904Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.2021-12-29T19:17:44.755447Z 0 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
2021-12-29T19:17:44.755572Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
2021-12-29T19:17:44.765931Z 0 [Note] Event Scheduler: Loaded 0 events
2021-12-29T19:17:44.766651Z 0 [Note] mysqld: ready for connections.
Version: '5.7.22' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
2021-12-29T19:18:08.804109Z 2 [Note] Access denied for user 'root'@'172.19.0.1' (using password: YES)
Nos logs conta acesso negado.
Está usando qual setup Docker, o Laradock?
Me dê mais detalhes do setup, que te ajudo a resolver o problema com o acesso.
estou usando o docker sem ser o laradock
já mudou o log, mudei o nome do banco
2021-12-30T00:09:28.699369Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-12-30T00:09:28.700640Z 0 [Note] mysqld (mysqld 5.7.22) starting as process 1 ...
2021-12-30T00:09:28.707343Z 0 [Note] InnoDB: PUNCH HOLE support available
2021-12-30T00:09:28.707414Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-12-30T00:09:28.707422Z 0 [Note] InnoDB: Uses event mutexes
2021-12-30T00:09:28.707427Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2021-12-30T00:09:28.707431Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2021-12-30T00:09:28.707436Z 0 [Note] InnoDB: Using Linux native AIO
2021-12-30T00:09:28.708727Z 0 [Note] InnoDB: Number of pools: 1
2021-12-30T00:09:28.709622Z 0 [Note] InnoDB: Using CPU crc32 instructions
2021-12-30T00:09:28.733003Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2021-12-30T00:09:28.750616Z 0 [Note] InnoDB: Completed initialization of buffer pool
2021-12-30T00:09:28.757698Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2021-12-30T00:09:28.786884Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2021-12-30T00:09:28.819444Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-12-30T00:09:28.819578Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-12-30T00:09:28.826422Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2021-12-30T00:09:28.827579Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2021-12-30T00:09:28.827633Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2021-12-30T00:09:28.828833Z 0 [Note] InnoDB: 5.7.22 started; log sequence number 12360228
2021-12-30T00:09:28.829348Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2021-12-30T00:09:28.830975Z 0 [Note] Plugin 'FEDERATED' is disabled.
2021-12-30T00:09:28.845654Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2021-12-30T00:09:28.846700Z 0 [Note] InnoDB: Buffer pool(s) load completed at 211230 0:09:28
2021-12-30T00:09:28.847410Z 0 [Warning] CA certificate ca.pem is self signed.
2021-12-30T00:09:28.854393Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2021-12-30T00:09:28.855156Z 0 [Note] IPv6 is available.
2021-12-30T00:09:28.855392Z 0 [Note] - '::' resolves to '::';
2021-12-30T00:09:28.855527Z 0 [Note] Server socket created on IP: '::'.
2021-12-30T00:09:28.934138Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2021-12-30T00:09:28.948824Z 0 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2021-12-30T00:09:28.949456Z 0 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode. 2021-12-30T00:09:28.949530Z 0 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2021-12-30T00:09:28.949926Z 0 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
2021-12-30T00:09:28.949976Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2021-12-30T00:09:28.950321Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.2021-12-30T00:09:29.181460Z 0 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
2021-12-30T00:09:29.181521Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
2021-12-30T00:09:29.207230Z 0 [Note] Event Scheduler: Loaded 0 events
2021-12-30T00:09:29.208151Z 0 [Note] mysqld: ready for connections.
Version: '5.7.22' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
Bom dia, Carlos, a solução do da porta do mysql caindo era porque o diretório do path var/lib/mysql não estava vazio e em relação ao problema de conexão recusada não consigo resolver
eu estou usando o larafood, sem ser o laradock, estava implementando o conhecimento desse curso de docker no larafood, mas não sei pq está recusando a conexão será que tem a ver a tabela permissions? SQLSTATE[HY000] [2002] Connection refused (SQL: select * from `permissions`)
Boa tarde, Carlos, encontrei o bug, está relacionado a classe AuthServiceProvider, quando tirei o gates da função boot o erro saiu, mas o sistema não pode ficar sem ACL, e agora?
Olá, Rafael!
Você pode adicionar isso no seu provider:
if ($this->app->runningInConsole()) return;
Ex: https://github.com/especializati/larafood/blob/master/app/Providers/AuthServiceProvider.php
Explico o motivo com detalhes no LaraFood, é por conta do life cycle do Laravel.
Precisa estar logado para conseguir responder a este ticket!
Clique Aqui Para Entrar!