centos安装MySQL出现问题与解决

我是直接运行命令:

yum install mysql

然后 执行 mysql -uroot -p

报错:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

执行命令:service mysqld start

报错:

Redirecting to /bin/systemctl start mysqld.service
Failed to start mysqld.service: Unit not found.

 

解决办法

yum install mariadb-server -y

安装后执行:

 systemctl restart mariadb.service

然后就ok了

 # systemctl restart mariadb.service
 # systemctl status mariadb.service
 # systemctl enable mariadb.service

 

 

 

 

你可能感兴趣的:(MySQL)