Unable to access MySQL DB created :(

Hi,

I have problem on my server as I can create some DB adn everything about it from Virtualmin for virtual servers but when customers try to use these DB they always get A database connection error :( What is wrong ? My server is connected to you and you check with DB created in commentsco account (it's a wordpress installation, and wp-config file is correlty setup but when you try to access it at http://commentsapp.co/index.php it gives a database connection !

Thanks,

Vincen

Status: 
Closed (fixed)

Comments

Howdy -- if you look in $HOME/logs/error_log, what errors appear there whenever you try to access the website? There may be a more specific database error located in there.

Hi Andrey,

Thansk for your answer but unhappy it's not helpful as error_log doesn't contain anything about issue :(

Vincen

That's pretty unusual -- the error_log for that domain should display any errors the website is generating.

However, we can look into a few other things -- what is the output of the following commands:

grep sock /etc/mysql/my.cnf
ls -l /var/lib/mysql/mysql.sock
ls -l /var/lib/mysql/mysqld.sock
ls -l /var/run/mysqld/mysqld.sock
ls -ld /var/run/mysqld

Some of those may produce a "not found" error, that's okay.

Just a hunch: Are you maybe using usernames longer than 16 characters for database users? MySQL usernames may be only 16 characters long. Virtualmin will display the MySQL username when you go to the user's details, if it differs from the "main" username.

First I checked and the new db I created with new login is definitively less than 16 characters ;) Here is result of commands requested:

root@pro:~# grep sock /etc/mysql/my.cnf socket = /var/run/mysqld/mysqld.sock socket = /var/run/mysqld/mysqld.sock socket = /var/run/mysqld/mysqld.sock root@pro:~# ls -l /var/lib/mysql/mysql.sock ls: impossible d'accéder à /var/lib/mysql/mysql.sock: Aucun fichier ou dossier de ce type root@pro:~# ls -l /var/lib/mysql/mysqld.sock ls: impossible d'accéder à /var/lib/mysql/mysqld.sock: Aucun fichier ou dossier de ce type root@pro:~# ls -l /var/run/mysqld/mysqld.sock srwxrwxrwx 1 mysql mysql 0 nov. 15 15:02 /var/run/mysqld/mysqld.sock root@pro:~# ls -ld /var/run/mysqld drwxr-xr-x 2 mysql root 80 nov. 15 15:02 /var/run/mysqld root@pro:~#

Thanks,

Vincen

Can you double-check the settings in your Wordpress config? MySQL by default listens only on localhost, so when you're using the external IP address of your server, Wordpress wouldn't be able to connect.

If that's okay, you might want to verify that the respective user can access the DB from the command line. In a shell, type: mysql -u username -p and enter the password. Then you should be able to list the accessible databases with show databases; and select the wordpress one with use wpdbname; and then list its tables with show tables; (note the semicolons).