当使用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>?
|