How To Reset MySQL Or MariaDB Root Password
Aus Thoms Wiki
Zur Navigation springenZur Suche springen
taken from https://www.ostechnix.com/how-to-reset-mysql-or-mariadb-root-password/
DB stoppen
systemctl stop mysql oder systemctl stop mariadb oder auch /etc/init.d/mysql stop
Next, restart the database server without permission checking using the following command:
mysqld_safe --skip-grant-tables &
Login
mysql
At the mysql> or MariaDB [(none)]> prompt, run the following command to reset the root user password:
UPDATE mysql.user SET Password=PASSWORD('NEW-PASSWORD') WHERE User='root';
FLUSH PRIVILEGES;
exit
WICHTIG FÜR MARIADB: (https://kofler.info/root-login-problem-mit-mariadb/), weil als plugin hier immer nur "unix_socket" drinsteht.
update mysql.user set plugin='' where user='root'; flush privileges;
Finally, shutdown the running database server that you started earlier with --skip-grant-tablesoption. To do so, run:
mysqladmin -u root -p shutdown
DB wieder starten
systemctl start mysql oder systemctl start mariadb
Verify if the password has really been changed using the following command:
mysql -u root -p