• 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

Resolved Can't get MySQL 8 in docker container available for other applications

SiegbertG

New Pleskian
Hello,

i am using Plesk on a Linux-System runnung MySQL 5.7 and don't want to change it because i don't know if all used applications are able to work with MySQL 8.

But now i tried to get Nextcloud running. Nextcloud neeed a newer MySQl and so i thougt it would be the best to set up MySQL 8 in a Docker-container and use this version for Nextcloud.
This is my configuration:
  • mySQL 8 with standard parameters and potmapping 3306 -> 3307 and 33060 -> 33070
I can call a dcoker-bash for the container with "docker exec -it mysql bash" and in this bash i can use MySQL, create users, create Datenbase and so on. I created a user named nc and i can log into MySQL with this user and crate a datebase named nc from this login. So there is a working database nc with a user nc.
root@h2386003:~# docker exec -it mysql bash
root@ba6171cb9c6e:/# mysql -u nc -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 8.0.27 MySQL Community Server - GPL

lsof shows me, that Docker is listening on port 3307:
docker-pr 9991 root 4u IPv4 1039308961 0t0 TCP *:33070 (LISTEN)
docker-pr 9998 root 4u IPv6 1039273738 0t0 TCP *:33070 (LISTEN)
docker-pr 10012 root 4u IPv4 1039302047 0t0 TCP *:3307 (LISTEN)
docker-pr 10020 root 4u IPv6 1039284601 0t0 TCP *:3307 (LISTEN)

But nextcloud-installer didn't use or didn't find this MySQL-service. I choose MySQL-Datebase, users nc with the passwort for nc, database nc and tried localhost:3307 and 127.0.0.1:3307.
1640849671878.png
I get this error:
Error while trying to create admin user: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [1045] Access denied for user 'nc'@'localhost' (using password: YES)
Then i tried to access the MySQL -Docker with phpMySQLAdmin.
  • install phpMySQLAdmin from Docker-Hub
  • leave all standards an add PMA_HOST 127.0-0-1 and PMA_PORT 3307
Error: mysqli::real_connect(): (HY000/2002): Connection refused
Whe i use localhost / 33ß7 i get "no such file or directory".

What is wrong in my configuration of MySQL in the docker-container?

best regards
Siegbert
 
Can you connect to your MySQL instance from the Plesk server with

# mysql -h 127.0.0.1 -P 3307 -u nc -p

Looks like nc user is not granted all necessary permissions.
 
Solve it: I have to create the mySQL user with 'create username identified by password' without a host. Not 'create username@hostname'

The problem was, that MYSQL searches in usertsble for usernane AND host.
 
Back
Top