Portal Home > Knowledgebase > MySQL and PostgreSQL > Can’t connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'


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




If you receive this error message when connecting to MySQL trough command line on your VPS hosting or dedicated server:

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

Then you have to use the following for access to MySQL -h 127.0.0.1:

mysql -h 127.0.0.1 -u dbuser -p database

If you receive this error message from web script, please check the status of the MySQL server.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read

* Minimum sign up periods for cPanel Web Hosting plans: Mini - 3mo., Pro - 1mo., Biz - 1mo., cPanel Reseller Hosting, Linux VPS, Windows VPS, Managed cPanel VPS and Dedicated Servers - 1mo. secret link
Accepted payments: Credit/Debit Card, Paypal, Payza, Skrill, WebMoney, CashU, Ukash, paysafecard, Bitcoin, Perfect Money, SolidTrust Pay, OKPay, EgoPay, Western Union/MG, Wire Transfer and more.