解決Linux MySQL報錯ERROR 2002 (HY000)
---------------------------------1---------------------------------
在Linux安裝MySQL有時候會出現[mysql]ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 這樣的錯誤,具體解決辦法如下:
[[email protected] ~]# rm -rf /var/lib/mysql/*
[[email protected] ~]# rm /var/lock/subsys/mysqld
rm: remove regular empty file `/var/lock/subsys/mysqld'? y
[
[[email protected] ~]# service mysqld start
[[email protected] ~]# /etc/rc.d/init.d/mysqld status
mysqld (pid 5457) is running...
---------------------------------2---------------------------------
[[email protected] /]# mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[
##########新增如下內容:
[client]
socket=/var/lib/mysql/mysql.sock
##########儲存退出後,
##########重啟mysql
[[email protected] /]# service mysqld restart
Shutting down MySQL. [ OK ]
Starting MySQL. [ OK ]
[[email protected] /]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[[email protected] /]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.45 MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'rootpassword' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'rootpassword' WITH GRANT OPTION;
exit
Bye
[[email protected] /]# mysql -u root -p
---------------------------------3---------------------------------
當用戶在執行mysql時報錯
"ERROR 2002 (HY000): Cant connect to local MySQL server through socket /tmp/mysql.sock (2)"
原因是由於mysql 的mysql.sock 預設是在/var/lib/mysql/mysql.sock下,但linux系統總是去/tmp/mysql.sock查詢,如果mysql.sock不存在,系統就會報錯。
解決辦法:
1.直接指定mysql通道
[[email protected] ~]# find / -name mysql.sock
/var/lib/mysql/mysql.sock
[[email protected] ~]# mysql --socket=/var/lib/mysql/mysql.sock
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.22
Type help; or \h for help. Type \c to clear the buffer.
mysql>
2. 為mysql.sock建立軟連線(類似快捷方式)
[[email protected] ~]# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
[[email protected] ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 5.0.22
Type help; or \h for help. Type \c to clear the buffer.
mysql>
相關推薦
解決Linux MySQL報錯ERROR 2002 (HY000)
---------------------------------1--------------------------------- 在Linux安裝MySQL有時候會出現[mysql]ERROR 2002 (HY000): Can't connect to loca
解決Linux MySQL報錯ERROR 2002
在Linux安裝MySQL有時候會出現[mysql]ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 這樣的錯誤,
解決MySQL報錯ERROR 2002 (HY000)
MySQL報錯 ERROR2002 配置文件 my.cnf MySQL安裝 今天在為新的業務線搭架數據庫後,在啟動的時候報錯root@qsbilldatahis-db01:/usr/local/mysql/bin# ./mysqlERROR 2002 (HY000): Can't
centos7下啟動MySQL報錯ERROR 2002 (HY000)的解決辦法
最近在安裝新的PHP開發環境,vagrant+virtualBox+centos7下安裝LNMP。遇到了無數多的坑,焦頭爛額。。。 記錄一下一些很奇怪的解決辦法吧。之前安裝了msql8.0.11,安裝參考部落格地址:安裝完成後,可以用初始密碼進入MySQ
Linux下 登入mysql報錯 ERROR 2002 (HY000): Can't connect to local MySQL server through socket....
查閱了無數資料,知道自己的mysql.sock檔案丟失了,想了一下,之前修改my.cnf檔案時,由於粗心把windows的路徑複製了進去,頭疼啊...... 看了一天網上的解決辦法,挨個試了一遍,最後發現其實只要一步就解決了: ERROR 2002 (HY000): Ca
MySql 報錯ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
MySql 報錯ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2) 這個錯是連結時報的錯,要連結必須啟動。修復的時候首先要啟動mysql。 首先
MySql 報錯ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
MySql 報錯ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2) 這個錯是連結時報的錯,要連結必須啟動。修復的時候首先要啟動m
MySQL登錄報錯ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
command sql ror total lock sta secure linux and [root@pisphkdcbsql01 mysql3307]# /opt/mysql3307/bin/mysql -upisp -ppisp@123 mysql:
mysql報錯-ERROR 2002
.so bsp 文件 nbsp 服務 存在 修改 重新啟動 -- 問題描述: 今天登錄mysql服務器,啟動數據庫登錄報如下錯誤: #ps -ef|grep mysql 確認mysql服務已啟動 然後修改.so
mysql 報錯ERROR 1820 (HY000):You must resetpassword
今天登入mysql(Server version: 5.7.11) 還是很好的,今天登入後執行任何命令都報下面的錯誤 mysql> help contentsERROR 1820 (HY000): You must reset your password using ALTER USER statem
mysql 報錯ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executin
<div id="article_content" class="article_content clearfix csdn-tracking-statistics" data-pid="blog" data-mod="popu_307" data-dsm="post"
登入mysql 報錯ERROR 1820 (HY000): You must reset your password using ALTER USER ......
1、原因:windows下首次登入mysq時報1820的錯誤,是因為安裝好mysql時密碼有一個指定的預設值,需要重置密碼才能正常使用資料庫,下面是解決該錯誤的方案: 1)在cmd下進入mysql安裝的bin目錄,登入mysql資料庫: ....\bin>mysql -hlocal
解決遠端Mysq連線sqlyog連線遠端mycat報錯ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.57.129' (0)
今天在linux中安裝了mycat,在使用sqlyog在連線mycat時候,一直鏈接不上,出現2003錯誤, ERROR 2003 (HY000): Can’t connect to MySQL server on ‘192.168.57.129’ (0) 分析,該錯誤可能導致的原因是
mysql調用存儲過程的時候,報錯ERROR 1436 (HY000): Thread stack overrun: 解決辦法
pro average cte bytes affect vim ini run lba mysql> call productpricing();ERROR 1436 (HY000): Thread stack overrun: 10368 bytes use
MySQL遠端訪問報錯ERROR 2003 (HY000):Can't connect to MySQL server on'XXXXX'(111)
從一臺linux遠端連線另一臺linux上的MySQL, mysql -hxxx.xxx.xxx.xxx -uroot -p 出現ERROR 2003 (HY000): Can't connect to MySQL server on 'xxx.xxx.xxx.xxx'(111)錯誤。
mysql-建立使用者報錯ERROR 1396 (HY000): Operation CREATE USER failed for 'XXXX'@'XXXX'
建立使用者: create user ‘test’@’%’ identified by ‘test’; 顯示ERROR 1396 (HY000): Operation CREATE USER fai
MySQL遠端訪問報錯ERROR 2003 (HY000):Can't connect to MySQL server on'XXXXX'(111)
從一臺linux遠端連線另一臺linux上的MySQL, mysql -hxxx.xxx.xxx.xxx -uroot -p 出現ERROR 2003 (HY000): Can't connect to MySQL server on 'xxx.xxx.xxx.xxx'(
MySQL 報錯 ERROR 1820 和 ERROR 1819 的解決辦法
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. ERROR 1819 (HY000):
MySQL 報錯 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 的解決辦法
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 這次申請的 CentOS 6。7 虛擬機器映象 自帶了 MySQL ,然而進入這個虛擬機器
遠端連線MySQL報錯ERROR 2003解決辦法
點選開啟連結 在mysql遠端連線時出現ERROR 2003錯誤的很多種,下面我來給大家介紹兩種解決此問題的方法,有需要的同學可參考。 問題程式碼程式碼 ERROR 2003 (HY000): Can't connect to MySQL server on '1