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

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

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知識。




主站蜘蛛池模板: 亚洲欧美日韩伦中文 | 四虎永久免费网站免费观看 | 亚洲免费在线视频 | 天天草比| 日韩免费高清一级毛片在线 | 亚洲精品一级毛片 | 午夜在线播放视频 | 青青草中文字幕 | 一区二区在线视频观看 | 婷婷丁香综合 | 亚洲成a人 | 色香蕉网| 日本亚洲网站 | 亚洲免费在线视频 | 日韩欧美一区二区在线观看 | 日韩专区第一页 | 亚洲熟区 | 在线观看色视频 | 色橹橹欧美在线观看视频高清 | 日本最新免费不卡二区在线 | 亚洲人网| 亚洲国产青草 | 亚洲 自拍 中文字幕 在线 | 天天操天天射天天色 | 欧美亚洲春色系列 | 日韩在线视频免费观看 | 午夜影院黄色片 | 亚洲视频三区 | 欧美限制级在线观看 | 日韩一区精品视频在线看 | 欧美一级在线视频 | 啪啪.com | 日韩avwww| 日本视频一区二区三区 | 亚洲黄页网站 | 欧美中文在线观看 | 日韩专区在线 | 亚洲国产一区在线精选 | 天堂新版www中文 | 天堂网在线新版www 天堂网在线网站成人午夜网站 | 欧美一级黄色录相 |