六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

mysql服務打開卻連接不上2種處理方法

[摘要]這篇文章主要為大家詳細介紹了mysql服務啟動卻連接不上的解決方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下mysql服務啟動,但是連接不上,如何解決?登陸報錯:root@localhost:~# mysql -u root -pEnter password:ERROR 2002 (HY0...
這篇文章主要為大家詳細介紹了mysql服務啟動卻連接不上的解決方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下

mysql服務啟動,但是連接不上,如何解決?

登陸報錯:

  root@localhost:~# mysql -u root -p
  Enter password:
  ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
  root@localhost:~# service mysqld restart
  Shutting down MySQL..                   [ OK ]
  Starting MySQL.                      [ OK ]
  root@localhost:~# mysql -u root -p
  Enter password:
  ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

分析原因:

原因不詳,知道了補上

解決方案一:

 root@localhost:~# find / -name mysql.sock
 /tmp/mysql.sock
 root@localhost:~# mysql -u root -p -S /tmp/mysql.sock
 Enter password:
 Welcome to the MySQL monitor. Commands end with ; or \g.
 Your MySQL connection id is 1
 Server version: 5.6.15-log Source distribution

 Copyright (c) 2000, 2011, 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>

解決方案二:

 root@localhost:~# find / -name mysql.sock
 /tmp/mysql.sock
 root@localhost:~# vi /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0

# 加上下面的這段代碼即可
[mysql]
socket=/tmp/mysql.sock

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

root@localhost:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.15-log Source distribution

Copyright (c) 2000, 2011, 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>

以上就是mysql服務啟動卻連接不上兩種解決辦法的詳細內容,更多請關注php中文網其它相關文章!


學習教程快速掌握從入門到精通的SQL知識。




主站蜘蛛池模板: 亚洲福利视频一区二区三区 | 日韩一级片在线免费观看 | 亚洲精品123区 | 日韩精品视频免费观看 | 亚洲最大成人网色 | 色综合久久综合 | 日韩日韩日韩 | 伊人久久中文字幕久久cm | 天天操天天摸天天曰天天干天天弄天天干 | 欧美一区二区三区在线可观看 | 五月婷婷六月合 | 亚洲综合成人网 | 亚洲第一视频区 | 日韩中文字幕在线亚洲一区 | 青青草原在线视频 | 偷自视频视频区免费 | 日韩美一区二区 | 五月激激激综合网色播免费 | 中文字幕亚洲综久久2021 | 午夜美女视频在线观看高清 | 四虎永久在线精品2022 | 午夜骚片 | 中文一区在线 | 日韩激情淫片免费看 | 午夜国产精品免费观看 | 欧美性黑人极品hd网站 | 青青草国产精品人人爱99 | 青青草原免费在线观看 | 我色综合 | 四虎国产精品永久地址48 | 天天爽夜夜爽一区二区三区 | 做受又硬又粗又免费视频 | 日韩免费在线视频观看 | 色伊人国产高清在线 | 亚洲欧美日韩在线精品一区二区 | 青青草国| 欧美一二三 | 亚洲成a v人片在线看片 | 视频二区 素人 欧美 日韩 | 亚洲综合15p | 小草社区在线观看播放 |