让人纠结的mysql Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock
CentOS下使用yum 安装mysql
在启动的时候会报这个错误
Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’
yum安装mysql这个包其实是MySQL 客户端程序和共享库,所以我们还需要安装php-mysql和mysql-server这两个包.
- [root@localhost ~] yum install mysql mysql-server php-mysql -y
- [root@localhost ~] chkconfig mysqld on
- [root@localhost ~] service mysqld start
- [root@localhost ~] service httpd restart