• 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

MySQL default host

P

Panther

Guest
Since Plesk 8.0, the default host name for MySQL users created by Plesk is the wildcard '%'. In Plesk 7.5 it was always "localhost". It appears that the wildcard works for everything but the localhost, so users are not able to access the databases they create without the admin going in and changing the host names to "localhost" in the mysql database user table.
 
I'm having the same problem. In fact. crating a new user and setting the host to % or localhost, I can't access the database at all.

I get this error:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'myusername'@'localhost' (using password: YES) in /var/www/vhosts/mydomain.com/subdomains/dev/httpdocs/index.php on line 167
error connecting: Access denied for user 'myusername'@'localhost' (using password: YES)

I'm using 8.0.1
 
It seems I found a solution. In a nutshell, I followed an advice from Paul DuBois of MySQL Documentation Team: "Check the user table to see if there is an account with a Host value of 'localhost' and a User value of '' (empty string). If there is, remove it (DELETE FROM user WHERE Host='localhost' AND User='') and then do FLUSH PRIVILEGES." (look at http://archives.neohapsis.com/archives/mysql/2004-q1/3549.html if in doubt)

The issue I suffered from was described in MySQL 3.23, 4.0, 4.1 Reference Manual, 5.7.5. Access Control, Stage 1: Connection Verification ( http://dev.mysql.com/doc/refman/4.1/en/connection-access.html ).

Unfortunately, it was a default setup of MySQL in CentOS 4 (and RHEL 4 too, I guess) to put an account with a Host value of 'localhost' and a User value of '' (empty string) into mysql.user table. :(
 
It is indeed the default setup on CentOS4 (I don't know for RHEL4).

When installing Plesk after the default setup, the localhost-row with empty pass is erased (I think by the psa-installer) but from that moment on, plesk always use the percent-sign when setting up a database.

So, if you erase the localhost with empty-pass line before installing plesk, no problem. Does anyone know a solution how to fix this after plesk has been installed on a server where the localhost/empty-pass line was present during the installation?
 
If anyone has a solution for this I would be grateful. I can work with the wildcard "allow from anywhere" %, but it doesn't sit right with my paranoid brain.

cheers,
b.
 
Back
Top