Reputation: 61
After installing Mariadb on Debian 9, I am trying to run /usr/bin/mysql_secure_installation. The script starts okay, but after I press 'enter' for no root password, I get 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 have to ctl-c to get out of the script.
The socket is set in /etc/mysql/debian.cnf to /var/run/mysqld/mysqld.sock It is also set in /etc/mysql/mariadb.conf.d/50-server.cnf to /var/run/mysqld/mysqld.sock
The server is not running.
Upvotes: 0
Views: 5274
Reputation: 61
After digging around many, many places, the answer was right under my nose on the Troubleshooting Connection Issues page at the MariaDB website 1
The error means that the server is either not running or running on a different port, socket or pipe. Since I knew the server was not running, I started it with
/etc/init.d/mysql start
before running the script and no more problems with the error or the script.
Upvotes: 0