If you're facing a problem trying to log into your MySQL database, and seeing the following error. "Access denied for user 'LANWAY'@'172.18.0.7' (using password: YES). (Error #1045)"
I encountered this issue when trying to connect to a new MySQL database using Coolify. Hopefully, you will find this information helpful.
Step 1
First, you will need to find your Docker container ID. This can be done by logging into your server and typing in the appropriate command.
To view all Docker containers, including stopped ones, use the command docker ps -a
or docker container ls -a
.
Step 2
docker exec -it [CONTAINER_ID] mysql -uroot -p
Replace [CONTAINER_ID] with your Docker container ID.
Enter password:
Step 3
CREATE USER '[UserName]'@'172.18.0.7' IDENTIFIED BY '[Password]';
Replace [UserName] and [Password] with your Username and Password.
Step 4
GRANT ALL PRIVILEGES ON *.* TO '[UserName]'@'172.18.0.7' WITH GRANT OPTION;
Replace [UserName] with your username.
Step 5
flush privileges;
exit
This should fix the problem.