Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

FireBlade's avatar

Laravel Mysql user on Docker unable to login

This is a part of the .env file


DB_CONNECTION=mysql
DB_HOST=lineke-db
DB_PORT=3306
DB_DATABASE=halls
DB_USERNAME="arsec"
DB_PASSWORD="RMDPst^2jhK@2"
DB_ROOT_PASSWORD="OfWIIlEJrozT*kA"

When I ran docker compose up -d, the database user was created with a wildcard host and the following privileges:

mysql> SHOW GRANTS FOR 'arsec'@'%';

GRANT USAGE ON *.* TO `arsec`@`%`
GRANT ALL PRIVILEGES ON `halls`.* TO `arsec`@`%`

Am unable to login with this user even at the mysql command line level


docker-compose exec lineke-db /bin/bash

I have created a new user:

CREATE USER 'vourge'@'localhost' IDENTIFIED BY 'Iv%**Wr52LhQ';
GRANT ALL PRIVILEGES ON halls.* TO 'vourge'@'localhost';

I can login with this user at the Mysql level command line but am not able to run php artisan migrate command even after restarting the containers.

0 likes
3 replies
Sinnbeck's avatar

Try allowing all hosts

CREATE USER 'vourge'@'%' IDENTIFIED BY 'Iv%**Wr52LhQ';
GRANT ALL PRIVILEGES ON halls.* TO 'vourge'@'localhost';
FireBlade's avatar

@Sinnbeck


ERROR 1410 (42000): You are not allowed to create a user with GRANT

this one works:

GRANT ALL PRIVILEGES ON halls.* TO 'vourge'@'%';

FireBlade's avatar

When I login as root via commend line and run this query:


select * from information_schema.tables where table_schema = halls and table_name = migrations and table_type = 'BASE TABLE'

I get an error:

Unknown column 'halls' in 'where clause'

Please or to participate in this conversation.