Cannot connect to MySQL from command line (shared hosting) Print

  • 25

If you get the following error:

"Can't connect to local MySql server throuh socket '/var/lib/mysql/mysql.sock' (2)"

when trying to connect to MySQL server from your shell account, it means that the mysql.sock file is not available inside the chroot environment.

To connect to MySQL, use the server hostname instead, ie.:

mysql -h -u username dbname

Was this answer helpful?

« Back