当前位置:   article > 正文

ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘ (2)_illegal authorization identifier near

illegal authorization identifier near

当使用mysql 本地client连接mysql提示如下错误:

[root@k8s-node1 mysql]# mysql -u root -ptest1234
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 '/tmp/mysql.sock' (2)

原因就是/tmp/mysql.sock文件不存在

查看/etc/my.cnf 文件配置

可以看到socket配置并不是/tmp/mysql.sock

解决:修改上面的配置为/tmp/mysql.sock

重启mysql,问题解决

[root@k8s-node1 mysql]# mysql -u root -ptest1234
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.16 MySQL Community Server - GPL

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小桥流水78/article/detail/950480
推荐阅读
相关标签
  

闽ICP备14008679号