Docker mysql ERROR 1396 (HY000): Operation CREATE USER failed for ‘root’@’%’

According to this github issue, the problem is setting MYSQL_USER to root. It will fail to create the second user 'root'@'%' since it will already exist in the users table.

Therefore, this can be solved by only setting MYSQL_ROOT_PASSWORD, MYSQL_DATABASE, and MYSQL_PASSWORD in the docker-compose.yml file.

Leave a Comment