Hey there 👋
I have a really strange problem, and I'm stuck now after having tried to solve this for hours.
The problem: I have a GitHub Actions-based build, which needs to start a MariaDB and connect to it. I start the MariaDB with the following command:
docker run -d -p 3309:3306 -e MYSQL_ROOT_PASSWORD=wolkenkit -e MYSQL_USER=wolkenkit -e MYSQL_PASSWORD=wolkenkit -e MYSQL_DATABASE=wolkenkit --name test-mariadb mariadb:10.4.10 --bind-address=0.0.0.0
This works fine. Afterwards I try to connect (after a sleep of 15 seconds to give the container enough time to start):
mysql --port=3009 --user=wolkenkit --password=wolkenkit --database=wolkenkit --verbose --execute="SELECT USER(),CURRENT_USER();"
This works locally on my macOS machine. But it does not work on GitHub Actions, instead I get an error message telling me:
ERROR 1045 (28000): Access denied for user 'wolkenkit'@'localhost' (using password: YES) ##[error]Process completed with exit code 1.
Why is that? What am I missing?
Solved! Solved! Go to Solution.
Please try to add --protocol=tcp setting to mysql command. Because you are running MySQL inside Docker container, socket is not available and you need to connect through TCP. Setting "--protocol" in the mysql command will change that.
And you specify a wrong port 3009 in mysql command, please correct it to 3309.
Oh… yes, the port is wrong 😳
It's *these* things that keep you trying for hours, and of course you look everywhere but there 😉
Fixing the port, setting the protocol and increasing the timeout helped.