ERROR 2002 (HY000): Can't connect server socket /tmp/mysql.sock
自己採用的解決方案:
啟動MySQL資料庫:
***@***-VirtualBox:~$ sudo /etc/init.d/mysql.server start
Starting MySQL
.... * The server quit without updating PID file (/usr/local/mysql/data/***-VirtualBox.pid).
針對以上錯誤,網上各種百度,各種谷歌都解決不了,還是提示上面的同樣的錯誤
我採用下面的方法,竟然可以啟動MySQL,但是又引發了其他的無法解決的error
################################## 方法如下 ##############################
按照網址:http://www.justin.my/2012/03/starting-mysql-error-the-server-quit-without-updating-pid-file/
竟然可以啟動MySQL服務,如下:
***@***-VirtualBox:/etc$ sudo mv /etc/my.cnf /etc/my.cnf.old
***@***-VirtualBox:/etc$ sudo /etc/init.d/mysql.server start
Starting MySQL
.. *
但是,無法登陸了:
***@***-VirtualBox:/etc/mysql/conf.d$ sudo mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
這個錯誤我用了各種辦法無法解決,無奈把my.cnf的名稱變回來:
***@***-VirtualBox:/etc$ sudo mv /etc/my.cnf.old /etc/my.cnf
####################################################################
解決方法:
檢視錯誤日誌,定位到日誌最後幾行:***@***-VirtualBox:/usr/local/mysql$ more ./data/***-VirtualBox.err
##### 日誌內容 start #####
140928 08:52:32 mysqld_safe mysqld from pid file /usr/local/mysql/data/ga
oyu-VirtualBox.pid ended
140928 10:53:01 mysqld_safe Starting mysqld daemon with databases from /u
sr/local/mysql/data
140928 10:53:01 [Note] Plugin 'FEDERATED' is disabled.
140928 10:53:01 InnoDB: The InnoDB memory heap is disabled
140928 10:53:01 InnoDB: Mutexes and rw_locks use InnoDB's own implementat
ion
140928 10:53:01 InnoDB: Compressed tables use zlib 1.2.3
140928 10:53:01 InnoDB: Using Linux native AIO
140928 10:53:01 InnoDB: Initializing buffer pool, size = 128.0M
140928 10:53:01 InnoDB: Completed initialization of buffer pool
140928 10:53:01 InnoDB: highest supported file format is Barracuda.
140928 10:53:01 InnoDB: Waiting for the background threads to start
140928 10:53:02 InnoDB: 5.5.39 started; log sequence number 44664632
140928 10:53:02 [ERROR] /usr/local/mysql/bin/mysqld: unknown variable 'de
fault-character-set=utf8'
140928 10:53:02 [ERROR] Aborting
140928 10:53:02 InnoDB: Starting shutdown...
140928 10:53:03 InnoDB: Shutdown completed; log sequence number 44664632
140928 10:53:03 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
140928 10:53:03 mysqld_safe mysqld from pid file /usr/local/mysql/data/ga
oyu-VirtualBox.pid ended
##### 日誌內容 end #####
記得自己為了解決同事的字元編碼問題,把自己機器上面的配置檔案修改過:修改了/etc/my.cnf裡面的【mysqld】的字元設定,在修改回來,試試看,修改方法如下:
把 [client] [mysqld] [mysql]裡面的 default-character-set=utf8 都註釋掉
發現好使了,可以成功登陸MySQL了。
***@***-VirtualBox:/usr/local/mysql$ sudo /etc/init.d/mysql.server start
Starting MySQL
.... *
***@***-VirtualBox:/usr/local/mysql$ sudo mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.39-log MySQL Community Server (GPL)
Copyright (c) 2000, 2014, 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>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26435490/viewspace-1283327/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ERROR 2002(HY000):Can't connect to local MySQL socket '/tmp/mysql.sock'ErrorMySql
- Can't connect to local MySQL server through socket '/tmp/mysql.sock'MySqlServer
- 解決Can 't connect to local MySQL server through socket '/tmp/mysql.sock '(2) "MySqlServer
- ERROR 2002 (HY000): Can't connect server socket /var/run/mysqld/mysqld.sockErrorServerMySql
- MySQL報錯'ERROR 2002 (HY000): Can't connect to local MySQL server through'MySqlErrorServer
- Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock錯誤MySqlServer
- linux下連線mysql報錯ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/var/lib/mysqLinuxMySqlErrorServer
- mysqldump: Got error: 2002: Can't connect to local MySQL server through.....MySqlGoErrorServer
- 更換mysql資料目錄後出現ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 的解決辦法MySqlErrorServer
- ERROR 2002 (HY000): Cant connect to local MySQL server through socket的解決方法ErrorMySqlServer
- ERROR 2003 (HY000)Can't connect to MySQL server on '192.168.8.247' (113)ErrorMySqlServer
- ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)ErrorMySqlServerlocalhost
- Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)解決方法MySqlServer
- mysql 啟動報錯Can't connect to local MySQL server through socket '/data/mysql/mysql/mysql.sock'(111)MySqlServer
- MySQL連線提示Can't connect to local MySQL server through socketMySqlServer
- mysql [ERROR] Can't create IP socket: Permission deniedMySqlError
- [jenkins]Can’t connect to window server – not enough permissionsJenkinsServer
- mysql can't connect error about privilege----not root userMySqlError
- MySQL 5.5 關閉資料庫報錯"Can't connect to local MySQL server through socket"MySql資料庫Server
- ERROR 1135 (HY000): Can't create a new threadErrorthread
- Can't connect to X11 window server usingServer
- 異常:Can't connect to MySQL server (10060)MySqlServer
- Error:Can't connect to SOCKS proxy:Connection refused (Connection refused)Error
- ERROR 1135 (HY000): Can't create a new thread (errno 11)Errorthread
- 【MySQL】ERROR 1005 (HY000): Can't create table' (errno: 150)MySqlError
- Can't connect to X11 window server using DISPLAY variableServer
- Can't connect to X11 window server using '127.0.0.1:0.0'Server127.0.0.1
- Navicat 連線 MySQL 失敗:2002-can‘t connect to server on localhost(10061)問題解決MySqlServerlocalhost
- ERROR 1005 (HY000): Can't create table 'starive.SC' (errno: 150)"Error
- 解決svnserve: Can't bind server socket: Address already in useServer
- error:'Can'tconnecttolocalMySQLserverthroughsocket'/var/lib/mysql/mysql.sock'(2)'ErrorMySqlServer
- 連線MySQL錯誤:Can't connect to MySQL server (10060)MySqlServer
- MySQL 2003 - Can’t connect to MySQL server on (10060)MySqlServer
- ERROR 1005 (HY000): Can't create table'matrix.system_log' (errno: 150)Error
- MySQL 5.5 原始碼安裝報錯"[ERROR] Can't start server"MySql原始碼ErrorServer
- MYSQL ERROR 2003 (HY000) CanMySqlError
- Error!: SQLSTATE[HY000] [2002] Connection refusedErrorSQL
- Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.Server