Can ' t connect to local MySQL server through socket '/tmp/mysql.sock '
The above tips may be encountered when starting MySQL, that is, in the/tmp/mysql.sock location can not find the required mysql.sock files, mainly due to the my.cnf file in the Mysql.sock location settings.
Mysql.sock default is in/var/lib/mysql, if it is found in this directory, you can add Mysql.sock path under [mysqld]
VI/ETC/MY.CNF (my.cnf may also be under other paths)
[Mysqld]
Port = 3306
Socket =/var/lib/mysql/mysql.sock
However, to ensure that users who use MySQL have write access to the directory, such changes will still be error due to permission restrictions.
So to avoid permission problems, you can also use soft links to create a join to/tmp/mysql.sock for/var/lib/mysql/mysql.sock
Ln-s/var/lib/mysql/mysql.sock/tmp/mysql.sock
Because the/tmp/folder defaults to other W permissions, you can avoid permissions issues.
In addition, if you find that Mysql.sock is not in the default/var/lib/mysql location, one workaround is to use the Find command to search for the location of the Mysql.sock and then choose one of the previous two solutions.
Display when starting MySQL:/tmp/mysql.sock non-existent workaround