Mysql – Can not reset MariaDB password “can’t connect to local MySQL server through socket”

mariadbMySQLpasswordpassword-recovery

When I go

mysqld_safe --skip-grant-tables &

This message is outputted.

170802 14:14:15 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

When I try to run mariadb, I get

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

When I check the logs, I don't see anything.

Best Answer

This is because mysqld_safe silently fails if it doesn't have permissions and it can't write to the log as in the event of being run as a regular user.

Instead run,

sudo mysqld_safe --skip-grant-tables &