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.

  • 70 أعضاء وجدوا هذه المقالة مفيدة
هل كانت المقالة مفيدة ؟

مقالات مشابهة

Can I connect to MySQL from my computer

Yes, you can. Just need to add your IP address in the hosts allowed to connect to MySQL. Adding...

Export and import of MySQL databases from cPanel

For management on databases in your hosting account you can use the web application phpMyAdmin....

Export and import MySQL databases via SSH

If you want to import your MySQL database through SSH on your VPS or dedicated server, use the...

How to see the MySQL variables

Log into your MySQL database and type: show variables; You will see the following: mysql>...

Optimization and repair of MySQL database

If you have suspicions that the MySQL database is running slowly or appear errors, you need to...