I tried to change MariaDB data directory to a new location from my SD Card (Raspberry Pi) to an external USB Stick. For this I used this tutorial:
Afterwards I run the following cmd, my complete database was broken. It probably didn't work correctly because I did not mentioned that the database was still running before doing the rsync command.
sudo rsync -av /var/lib/mysql /mnt/mydisk
Now I always get strange error messages when I try to connect to the database:
pi@raspberrypi:/etc $ sudo mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
pi@raspberrypi:/etc $ sudo service mysql start
Job for mariadb.service failed because the control process exited with error code.
See "systemctl status mariadb.service" and "journalctl -xe" for details.
pi@raspberrypi:/etc $
I followed many posts here like:
But nothing helps. So I tried to reinstall MariaDB completely. I followed this tutorial for the deinastallation:
https://mariadb.com/kb/en/completely-unistall-and-then-reinstall-mariadb-103/
But this doesn't work! After reinstalling, I run in the same fault. So I think the reinstallation doesn't work properly.
When I tried this solution: https://stackoverflow.com/a/15039113/5467686
I mentioned, that there is no /etc/my.cnf. Do I have to create it by myself?