Centos6.5x64 Install Zen Road 6.2, generate configuration file, database connection failed
Database connection failed sqlstate[hy000] [2003] Can ' t connect to MySQL server on ' 127.0.0.1 ' (13)
Root, the password must not be wrong (command line can login), with the 127.0.0.1
PHP is installed properly, MySQL configuration is correct, PHP PDO, MySQL extension correct, use
<?php
$link=mysql_connect('localhost','root','password');
if ($link)
echo "successfu";
else
echo "Faile";
mysql_close();
?>
PHP code can properly connect to the database, but the installation of Zen channel is always not connected to the MySQL database
Can ' t connect to MySQL server on ' 127.0.0.1 ', a variety of reasons for analysis without fruit, and finally carefully read the my.cnf file, found mysqld with user=mysql information, as follows:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
will user=mysql this as User=rootAfter restarting the MYSQLD service after installing everything normal, official parameter explanation:
MYSQLD program will be executed under a given Unix/linux account after launch; Mysqld must be started from the root account in order to switch to another account after booting; The Mysqld_safe script will use the –USER=MYSQL option by default to start the MYSQLD program.
For specific parameters, please refer to: MySQL configuration parameters detailed
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
MySQL database connection failed sqlstate[hy000] [2003] Can ' t connect to MySQL server on ' 127.0.0.1 ' (13)