• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Access Mysql from Docker

Phthisicus

New Pleskian
Hi Everyone,

I am trying to connect to the build in MySQL server of Plesk from a Docker container. But i get the following messages:

Could not connect to MySQL database at 10.0.0.100: Access denied for user 'user'@'172.17.0.2'

I am able to login to the MySQL server with that user from other networks even external exept from within the docker container.
The user also has '%' access permissions. I configured the my.cnf of mysql to bind it to :: so every ipv4 and ipv6 adress is able to connect to it.

Is there something i am missing?
 
- Start your MySQL docker from the Command Line as Root

docker run --name=mysql8 -v /path/mysql/datadir:/var/lib/mysql -v /root/mysql8/conf.d:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=RootPassword -p 127.0.0.1:3307:3306 -p 127.0.0.1:33061:33060 "mysql:latest"

- Add the new Database Server to the Plesk via Tools & Settings > Database Servers - Host - 127.0.0.1

- In a Subscription, When you are creating a new database on this new DB server, Select Allow remote connections from any host

This docker is BInd to the Localhost, It will not be accessible externally.
 
Additionally to the above post,

-v for Volume Mapping

-p for Port Mapping

$mysql -h 127.0.0.1 -P 3307 -u user_name -p

Or in your application config file, Eg - 'host' => '127.0.0.1:3307' (Magento 2)
 
Back
Top