While login to the Plesk Panel you may get the following error:
Quote:
|
ERROR: PleskFatalException Unable to connect to database: mysql_connect() [<a = href='function.mysql-connect'>function.mysql-connect</a>= ]: Can't connect to local MySQL server through socket = '/var/lib/mysql/mysql.sock' (2) 0: common_func.php3:95 =09psaerror(string 'Unable to connect to database: mysql_connect() = [<a = href='function.mysql-connect'>function.mysql-connect</a>= ]: Can't connect to local MySQL server through socket = '/var/lib/mysql/mysql.sock' (2)') 1: auth.php3:124
|
Check the mysql service status on the server
Quote:
Quote:
|
-bash-3.2# /etc/init.d/mysqld status
|
mysqld dead but subsys locked
|
You see the mysql service is dead and hence cannot login to Plesk.
Try restarting the mysql service.
Now while restarting the mysql service you may get the following error:
Quote:
-bash-3.2# /etc/init.d/mysqld start
chown: `mysql:mysql': invalid user
chown: `mysql:mysql': invalid user
|
Checking the
mysql logs you get the error logs as below :-
Quote:
-bash-3.2# tail /var/log/mysqld.log
110501 23:38:01 mysqld started
110501 23:38:01 [ERROR] Fatal error: Can't change to run as user 'mysql' ; Please check that the user exists!
110501 23:38:01 [ERROR] Aborting
110501 23:38:01 [Note] /usr/libexec/mysqld: Shutdown complete
|
As the error suggests the user '
mysql' does not exist.
Add the 'mysql' user
Go to mysql directory.
Quote:
|
-bash-3.2# cd /var/lib/mysql/
|
Check the ownerships
Quote:
-bash-3.2# ls -la
-bash-3.2# drwx------ 2 27 27 4096 Nov 7 22:28 mysql
|
You see the ownership isn't right.
Assign the ownership recursively to the
mysql user
Quote:
|
-bash-3.2# chown mysql.mysql -R /var/lib/mysql
|
Then try to start the mysql service.
Quote:
-bash-3.2# /etc/init.d/mysqld start
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL: [FAILED]
|
Again the mysql service failed to restart..
Check the
mysql logs once again.
Quote:
-bash-3.2# tail /var/log/mysqld.log
110501 23:50:23 mysqld started
110501 23:50:23 InnoDB: Started; log sequence number 1 2821668223
110501 23:50:23 [ERROR] /usr/libexec/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 13)
110501 23:50:23 [ERROR] Can't start server: can't create PID file: Permission denied
110501 23:50:23 mysqld ended
|
Now you see there is different error coming up.
Check the ownership of
/var/run/mysqld/
Quote:
-bash-3.2# ls -ld /var/run/mysqld/
drwxr-xr-x 2 27 27 4096 May 1 21:49 /var/run/mysqld/
|
You notice that the ownership isn't right..
Correct the ownership of
/var/run/mysqld/
Quote:
|
-bash-3.2# chown mysql.mysql /var/run/mysqld/
|
Then try to restart the mysql service..
Quote:
-bash-3.2# /etc/init.d/mysqld start
Starting MySQL: [ OK ]
|
and it's started just fine !
And now you can successfully login to the Plesk Panel.