首页 > 代码库 > Linux 使用yum install安装mysql登陆不上解决办法

Linux 使用yum install安装mysql登陆不上解决办法

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

 

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这两个包.

 

 

[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