1. 程式人生 > >connection to dat Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

connection to dat Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

[[email protected] etc]# tail -f /var/log/zabbix_server.log 
1267:20130722:195451.493 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
1267:20130722:195451.493 Database is down. Reconnecting in 10 seconds.
1267:20130722:195501.494 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
1267:20130722:195501.494 Database is down. Reconnecting in 10 seconds.
1267:20130722:195511.494 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
1267:20130722:195511.494 Database is down. Reconnecting in 10 seconds.
1267:20130722:195521.495 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
1267:20130722:195521.495 Database is down. Reconnecting in 10 seconds.
1267:20130722:195531.495 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
1267:20130722:195531.496 Database is down. Reconnecting in 10 seconds.
1267:20130722:195541.496 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
1267:20130722:195541.496 Database is down. Reconnecting in 10 seconds.
1267:20130722:195551.498 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
1267:20130722:195551.498 Database is down. Reconnecting in 10 seconds.


解決辦法:
[

[email protected] lib]# mkdir /var/lib/mysql
[[email protected] lib]# ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock
[[email protected] lib]# /etc/rc.d/init.d/mysqld restart
Shutting down MySQL... SUCCESS! 
Starting MySQL SUCCESS! 

參考:

相關推薦

MySQL ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

在solaris 和 ubuntu下啟動Mysql, 都提示了這樣的錯誤 在網上搜索了許多解決方案之後,做如下總結: 1、mysql 沒有啟動,或者說是無法啟動,則之後執行Mysql的時候會提示這個錯誤。     而啟動mysql的時候在/etc/init.d目錄下啟動,有

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

今天伺服器遇到了一個很熟悉的問題 輸入 #mysql -u root -p ERROR 2002 (HY000):Can't connect to local MySQL server 隨即上網找尋答案 根據大家提供的方法我逐一嘗試 方案1.  1.#ps -A|grep mysql   

connection to dat Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

[[email protected] etc]# tail -f /var/log/zabbix_server.log  1267:20130722:195451.493 [Z3001] connection to database 'zabbix' failed: [2002] Can't co

Cant connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ 解決

bsp 文件讀取 my.cnf dir spa min pre 啟動 style mysql 改變 basedir 目錄,啟動後客戶端登陸出現 Can’t connect to local MySQL server through socket ‘/var/lib/mys

Cant connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ 解決

mysql 改變 basedir 目錄,啟動後客戶端登陸出現  Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’  問題,解決方式如下: /etc/my.cnf &nbs

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysqld.sock'

先檢視 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已經啟動. 另外看看是不是許可權問題. ———————————————————————————— [[email protected] beinan]#chown -R mysql:mysql /var

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

1:下載 [[email protected] /]# tar -xzvf mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz -C /usr/local/ 1 3修改檔案 [[email protecte

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

如題所示,在Linux系統中啟動mysql報錯了: 能啟動mysql,但登入不了 網上存在各種各樣的方法和系統提示的最終還是沒有解決我的問題,因為在我的那個系統找不到所說的檔案 於是乎,乾脆殺掉程序試試: 然後重啟mysql 解決

Linux上mysql登陸錯誤解決辦法ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' 解決方法:1:首先確認你在root許可權下 [[email p

Can't connect to local MySQL server through socket '/var/lib/mysql'

在配置 sphinx報這個錯 ERROR: index 'test1': sql_connect: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) (D

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (

某一次我可能沒有正常關閉Mysql就直接讓機器關機了,造成了MySQL下次都打不來了。 先檢視程序 ps -A | grep -i mysql 如果Mysql程序開啟了 就把這個程序kill -9 ,然後再啟動試試。 但我的mysql程序就是沒有啟動起來

mac mysql啟動不了 Can 't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock '(2)

      官方直接下載的安裝包安裝後會出現一些問題,所以建議用工具下載安裝 mac的mysql意外無法正常啟動。 sudo mysql.server start Password: Starting MySQL .. ERROR! The server qu

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock

問題描述 今天阿里雲伺服器安裝mysql的收,遇到了一個很熟悉的問題 輸入 #mysql -u root -p ERROR 2002 (HY000): Can't connect to local MySQL server through sock

MYSQL啟動異常:Can 't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock '(2) "

一次異常關機之後,再次啟動mysql服務,報出異常Can 't connect to local MySQL server through socket '/var/lib/mysql/mysql.s

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

今天在linux裡安裝mysql,執行時遇到這樣的錯誤 ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ 上網

MySQL連線報錯:Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

MySQL連線報錯:Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (111) 報錯原因

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'的解決

# # The MySQL database server configuration file. # # You can copy this to one of: # - "/etc/mysql/my.cnf" to set global options, # - "~/.my.cnf" to set us

Linux登入mysqlCan't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

在登入Linux上,用mysql -uroot -proot 登入時出現了Warning: Using a password on the command line interface can be insecure. ERROR 2002 (HY000):

centos下mysql問題記錄--ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/

一、關於雲主機的mysql最近一次雲主機的伺服器由於被攻擊便打算重灌一邊mysql,徹底刪除相關檔案後重新安裝,沒想到怎麼裝都會出問題。再啟動的時候總是出現ERROR 2002 (HY000): Can’t connect to local MySQL server thro

用c語言連結MySQL資料庫出現Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

這個問題,困擾了我好幾天,最後終於解決了。首先,我用find命令找了半天,也只有/tmp/mysql.sock,當時我很崩潰啊,後來看到一篇文章,我忘了地址,讓我有感,於是解決了這個問題。 1、在/var/run/目錄下建立一個mysqld的資料夾(如果這個資