CentOS yum安装mysql后 Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’

 

CentOS Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’

如果仅仅只yum 安装了mysql这个包,启动mysql时就会提示:
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’

yum安装mysql这个包其实是MySQL 客户端程序和共享库,所以我们还需要安装php-mysql和mysql-server这两个包.

 
1 [root@localhost ~] yum install mysql mysql-server php-mysql -y
2 [root@localhost ~] chkconfig mysqld on
3 [root@localhost ~] service mysqld start
4 [root@localhost ~] service httpd restart

你可能感兴趣的:(mysql,centos,socket,server,service)