Can't connect to MariaDB through mysql command line client

I have installed the xampp stack which now includes MariaDB. I have been connecting to it with phpMyAdmin and php scripts through Apache as localhost. This all works with no problem. Today I tried to use the mysql command line tool and got the following error:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")

I checked, and indeed that path does not exist. I did, however find the following path:


Is it possible that the xampp stack installs the database files in a non-standard location and I need to tell mysql about the change? If so, how?

Answer Answered by Brian Evans in this comment.

The mysql client binary is compiled with a default socket location. You can specify this when it is being built.

You may also override the default location in the [client] section of the my.cnf (or my.ini on Windows) so you won't need to specify this on each invocation of the command.


Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.