I am trying to install wordpress into my system at fedora 17. I am getting error with database connectivity:
Error establishing a database connection
I have done below troubleshooting.
-
I have tried with command prompt to connect mysql database with same credentials and its connected successfully.
-
Than I tried to connect to database directly using php using below code.
<?php $db = @mysql_connect('localhost', 'wpuser', 'wppassword'); if (!$db) echo "connection failed --". mysql_error(); else echo "connection succeeded"; ?>
I received error:
connection failed –No such file or directory
Than I have recompiled php with apache2 and mysql than the same code is throwing error:
connection failed –The server requested authentication method umknown to the client
mysql conf file is as below.
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
also at php.ini I have set
mysql.default_socket = /var/lib/mysql/mysql.sock
Please let me know how to proceed further.I am still getting the same error for wordpress.
The first error
is because of the path to
mysqld.sock
file is wrong. This probably has been fixed as you state later that another error you recieve isThis error has been explained here on ServerFault