您好,登錄后才能下訂單哦!
防偽碼:沒(méi)有相當(dāng)程度的孤獨(dú)是不可能有內(nèi)心的平和。
【現(xiàn)象】
mysql.sock被刪除,導(dǎo)致無(wú)法連接數(shù)據(jù)庫(kù)。
[root@MySQL-01 ~]#mysql -uroot -p Enter password: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
提示無(wú)法通過(guò)mysql.sock連接MySQL server。
【解決】
方案一:重啟數(shù)據(jù)庫(kù)會(huì)重新創(chuàng)建mysql.sock。
方案二:若暫時(shí)無(wú)法重啟數(shù)據(jù)庫(kù),可以通過(guò)TCP協(xié)議連接數(shù)據(jù)庫(kù)。
MySQL默認(rèn)使用的是UNIX套接字文件連接,而不是TCP/IP從。MySQL4.1開(kāi)始,可以用--protocol=TCP|SOCKETPIPE|MEMORY指定選項(xiàng)連接數(shù)據(jù)庫(kù)。
[root@MySQL-01 ~]#mysql -uroot -p --protocol=TCP Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 16127 Server version: 5.6.36-log MySQL Community Server (GPL) Copyright (c) 2000, 2017, 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>
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。