[root@localhost ~]# mysql -hlocalhost -uroot -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘ (111)
查看mysql状态,没有起来
[root@localhost ~]# systemctl status mysqld
● mysqld.service - SYSV: MySQL database server.
Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since 一 2018-05-07 18:55:45 CST; 3min 10s ago
Docs: man:systemd-sysv-generator(8)
Process: 995 ExecStart=/etc/rc.d/init.d/mysqld start (code=exited, status=1/FAILURE)
5月 07 18:55:37 localhost.localdomain systemd[1]: Starting SYSV: MySQL database server....
5月 07 18:55:45 localhost.localdomain mysqld[995]: MySQL Daemon failed to start.
5月 07 18:55:45 localhost.localdomain mysqld[995]: Starting mysqld: [失败]
5月 07 18:55:45 localhost.localdomain systemd[1]: mysqld.service: control process exited, code=exite...s=1
5月 07 18:55:45 localhost.localdomain systemd[1]: Failed to start SYSV: MySQL database server..
5月 07 18:55:45 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state.
5月 07 18:55:45 localhost.localdomain systemd[1]: mysqld.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost run]# mkdir -p /var/run/mysqld
[root@localhost run]# chown mysql.mysql mysqld
[root@localhost run]# systemctl start mysqld
开启成功!
原文地址:http://blog.51cto.com/12131824/2113460