91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

MySQL報錯'ERROR 2002 (HY000): Can't connect to local MySQL server through'

發布時間:2020-08-15 09:47:21 來源:ITPUB博客 閱讀:168 作者:feelpurple 欄目:MySQL數據庫
登陸數據庫保存
[root@localhost Percona-Server-5.6.34-rel79.1-Linux.x86_64.ssl101]# bin/mysql -h localhost -P 3306 -uroot -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

查看數據庫用戶
mysql> select host, user from mysql.user;
+-----------------------+----------------+
| host                  | user           |
+-----------------------+----------------+
| %                     | ADMGEMALTO     |
| %                     | MGRGEMALTO     |
| %                     | TECHADMGEMALTO |
| localhost             | ADMGEMALTO     |
| localhost             | MGRGEMALTO     |
| localhost             | TECHADMGEMALTO |
| localhost             | root           |
| localhost.localdomain | root           |
+-----------------------+----------------+
8 rows in set (0.00 sec)

解決方法:
在MySQL中,需要使用socket方式連接localhost;而當使用-h選項登陸數據庫時,后面接的應該是IP地址或主機名。

查詢socket

[root@localhost Percona-Server-5.6.34-rel79.1-Linux.x86_64.ssl101]# ps -ef|grep mysql

root      2940  2917  0 15:31 pts/0    00:00:00 /bin/sh bin/mysqld_safe --defaults-file=/u01/mysql_data/my.cnf
mysql     3837  2940  0 15:31 pts/0    00:00:07 /mysql5.6/Percona-Server-5.6.34-rel79.1-Linux.x86_64.ssl101/bin/mysqld --defaults-file=/u01/mysql_data/my.cnf --basedir=/database/percona --datadir=/u01/mysql_data --plugin-dir=/database/percona/lib/mysql/plugin --user=mysql --log-error=/u01/mysql_data/mysqld_error.log --open-files-limit=8192 --pid-file=/u01/mysql_data/localhost.localdomain.pid --socket=/u01/mysql_data/mysql.sock --port=3306
root      5346  2917  0 17:05 pts/0    00:00:00 grep mysql

使用-S連接socket的方式登錄數據庫

[root@localhost Percona-Server-5.6.34-rel79.1-Linux.x86_64.ssl101]# bin/mysql -S /u01/mysql_data/mysql.sock -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 29
Server version: 5.6.34-79.1-log Percona Server (GPL), Release 79.1, Revision 1c589f9

Copyright (c) 2009-2016 Percona LLC and/or its affiliates
Copyright (c) 2000, 2016, 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.

使用-h接主機名的方式連接到數據庫
[root@localhost Percona-Server-5.6.34-rel79.1-Linux.x86_64.ssl101]# bin/mysql -h localhost.localdomain -P 3306 -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 30
Server version: 5.6.34-79.1-log Percona Server (GPL), Release 79.1, Revision 1c589f9

Copyright (c) 2009-2016 Percona LLC and/or its affiliates
Copyright (c) 2000, 2016, 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.

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

洛川县| 舒城县| 沧源| 宁明县| 章丘市| 石阡县| 大竹县| 宝鸡市| 镇巴县| 达尔| 嘉义县| 巴林左旗| 分宜县| 松溪县| 周宁县| 饶河县| 民和| 屯留县| 保亭| 小金县| 辽中县| 梓潼县| 远安县| 晋州市| 凌云县| 广平县| 竹溪县| 昭通市| 温宿县| 句容市| 鹤山市| 普洱| 游戏| 奉贤区| 新乡县| 东兴市| 历史| 疏勒县| 壤塘县| 海原县| 张北县|