matomo-org / matomo-org/docker
Random MySQL 1045 errors on Docker-setup, while un+pw are correct
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 1k
- Forks
- 384
- PR merge metrics
- No merged PRs in 30d
Description
Matomo gives MySQL 1045 errors all the time.
SQLSTATE[HY000] [1045] Access denied for user 'matomo'@'172.18.0.4' (using password: YES)
Suddenly it connects again (when I try random things like change the password in config.ini.php or redo a grant-statement in mysql), but then it suddenly stops the connection. It stops working at random moments, but always stops working when I reboot the server. Multiple refreshes did not result in one correct connection, so I seem to have to edit the config-file to have a real shot.
The setup is five dockers: Nginx-proxy, letsencrypt-nginx-proxy-companion, MySQL, Wordpress and Matomo. Matomo and Wordpress are accessible via https on their own sub-domain. This setup is to replace a non-virtualised machine, which is working fine. The data and settings have been copied 1-on-1, except the username and password for the database.
As -link is deprecated in Docker, I had to use my own bridge in Docker and reference by name to connect to the database. This works stable and fast, as long as you use the default bridge for connecting and the new bridge for the DNS-handling. You see that when I put the name of the docker "MySQL" or full "MySQL.dockernet" it returns the IP of "MySQL" at the default bridge. I suggest you use this setup too, because of the deprecation.
Connecting as root, MYSQLI-adapter or via ip-address does not help - it gives the same error. When I change the name of the database, it gives errors that are expected: no database there. Removing all in ./tmp did neither help, as I thought the DB-connection might be cached somewhere. The strangest thing was when it did connect when I set mysql_native_password in mysql.user, but again temporary. All MySQL users are available via 172.%.
mysql> select User, Host from mysql.user;
+------------------+-----------+
| User | Host |
+------------------+-----------+
| matomo | 172.% |
| root | 172.% |
| wordpress | 172.% |
What could have happened is that I changed something important and made everything worse, so I did rebuild the container and replaced the volume with a new one. I did not rebuild the MySQL docker.
As Wordpress, but also mysql-client (as Matomo-user) connect without problems , I think it's how Matomo brings up the database-link. As Docker is far from easy to log problems and Matomo does not log database-stuff (for security reasons), I'm seeking assistance in debugging this. I hope it makes Matomo's database-connector more stable for other users too. Thanks in advance!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the MySQL 1045 failure after reboot and inspect the Docker setup, config.ini.php, and connection behavior for Matomo and MySQL. Done means identifying a reproducible cause and documenting or implementing a stable database connection that remains reliable after restarts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, mysql
- Domain
- databases, infrastructure
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100