3

When I run following command

mysqld_safe --skip-grant-tables &

I get message

myuser@myvm:~$ 200523 08:24:41 mysqld_safe Logging to syslog. 200523 08:24:41 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

After that when I type mysql then I get 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")

How do I restart mariadb in safe mode to reset root password?

Frank Martin
  • 451
  • 1
  • 5
  • 18

2 Answers2

0

You startt the server with following restrictions

(Then) ithout a password and with all privileges, and disables account-management statements such as ALTER USER and SET PASSWORD. Because this is insecure, if the server is started with the --skip-grant-tables option, it also disables remote connections by enabling skip_networking.

This comes from how to reset root passwored

The safe mode is only practical, when doing ridumietery things like resetting roor password.

So explain better what you want to do, maybe there is a better or otheer solution

nbk
  • 8,699
  • 6
  • 14
  • 27
0

I logged in as root and now I am able to connect to mariadb under safe mode. That's because according to https://mariadb.com/kb/en/mariadb/unix_socket-authentication-plugin/ explains that the Unix Socket enables logging in by matching uid of the process running the client with that of the user in the mysql.user table. In other words to access mariadb as root you have to be logged in as root.

Frank Martin
  • 451
  • 1
  • 5
  • 18