Jasmine-liang / gitblog

"Peope Die, But Long Live Github"
0 stars 0 forks source link

[Solved]Can't connect to [local] MySQL server in Linux #4

Open Jasmine-liang opened 3 years ago

Jasmine-liang commented 3 years ago

Check the MYSQL Reference Manual

MySQL :: MySQL 5.6 Reference Manual :: B.3.2.2 Can't connect to [local] MySQL server I know there are two ways of connecting the mysqld server in Unix, So I quckly found that the/tmp/mysql.sock was missing.

Solution

資料庫中mysql.sock不存在問題,Can 't connect to local MySQL server through socket '/tmp/mysql.sock '(2) " - IT閱讀 Then use systemctl start mysqld.service to start the server.
Use systemctl status mysqld.service to check the status of the server.

Jasmine-liang commented 3 years ago

mysql

Jasmine-liang commented 3 years ago

mysql
Solution: ln -s /var/lib/mysql/mysql.sock /run/mysqld/mysqld.sock
Start MySql:

  systemctl start mysqld.service
  mysql -u root -p