# mysql -uroot -pEnter password:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
如果只是登陆查询用,可以 # mysql -uroot -h 127.0.0.1 -p 即可,如果要详细参见:https://blog.csdn.net/hjf161105/article/details/78850658