ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2) with MariaDB & MySQL

This happens to me sometimes when a mariadb update occurs.
In my case the issue is usually within the service file itself. Check the user running the service:

$ cat /usr/lib/systemd/system/mariadb.service

capture-200801-031604
Then check if that user has read/write rights to the folder/file mentioned in the error.
Also if your database files are located somewhere other than the default, check that the datadir=[database_files_path] is correctly set up in /etc/my.conf
Sometimes the file gets overwritten on updates.
If it’s set to a folder in your /home /run/user /usr /boot or /etc directory make sure to allow this by setting the ProtectHome or ProtectSystem parameters to false in the service file (/usr/lib/systemd/system/mariadb.service):
capture-200801-032401