• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

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)
 
A late follow up but hopefully useful to someone..

On Plesk 18, Docker instances can't access the main Plesk DB server locally. Therefore you need to set the DB Host as the server's public IP and ensure all firewalls allow traffic through (both on Plesk and on any network firewall). Furthermore, this was the critical setting that we found needed to be turned on:

Screenshot 2024-07-16 at 21.34.56.png

In our case we're trying to get wiki.js running on docker - but using the standard mariadb server.
 
I might be wrong.. but the docker instant should be able to access the Local DB without above option or the firewall settings. I have done this before.

Did you try both localhost and 127.0.0.1 for the DB settings in your Docker Instant?

By the way which docker is this?
 
Sorry, I didn't mention this in my above post.

Please try this.

Create this docker via command line.

Code:
#docker run --network host --name=Wiki requarks/wiki

Then the settings.

Firefox_Screenshot_2024-07-17T01-25-26.278Z.png


You should be able to connect to local DB without allowing local DB to connect from external connections or the firewall changes.
 
This does not work for passbolt. I get bind errors like this:
Code:
nginx: [emerg] still could not bind()
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)

I gave up... I often give up using Plesk...
 
This does not work for passbolt. I get bind errors like this:
Code:
nginx: [emerg] still could not bind()
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)

I gave up... I often give up using Plesk...

This is unrelated to the Plesk. The Ports 80 and 443 have been already used by NGINX as expected.

I haven't tried this Docker myself. Please refer to the https://hub.docker.com/r/passbolt/passbolt/
 
Back
Top