I'm trying to use MySQL
on Arch Linux. it is already installed but this error comes up when I try to connect:
connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2 "No such file or directory")'
I've looked for /etc/my.cfg
but the file does not exist.
Something must have gone wrong during the installation.
How can I "purge" MariaDB
and reinstall it?
If you're using archlinux
it is a vital idea to understand the package manager (pacman
). For the question about /etc/my.cfg
you can run
pacman -Ql mariadb
there you will see that the file is actually called:
/etc/mysql/my.cnf
Arch linux will not configure the package for you, that is part of the arch philosophy. It will provide example configurations, and even provide you with a systemd
unit file
usr/lib/systemd/system/mysqld.service
but it is your responsibility to ensure that the configuration is correct and actually start the daemon.
systemctl enable mysqld # add the unit file to the boot sequence
systemctl start mysqld # runs ExecStart= in the unit file
systemctl stop mysqld # kills the daemon
systemctl disable mysqld # remove unit from boot sequence
Since the word reinstall is in the title of the question and someone might find this question thanks to that: To reinstall mariadb
you simply do
pacman -S mariadb
pacman
will reinstall a package that is already installed, there is no need to remove the package (for completeness, package removal happens with pacman -R
)