How To Reset MySQL Or MariaDB Root Password: Unterschied zwischen den Versionen

Aus Thoms Wiki
Zur Navigation springenZur Suche springen
all>Verkehrsminister
Keine Bearbeitungszusammenfassung
K 3 Versionen importiert
 
(Eine dazwischenliegende Version von einem anderen Benutzer wird nicht angezeigt)
Zeile 28: Zeile 28:
FLUSH PRIVILEGES;
FLUSH PRIVILEGES;
exit
exit
</pre>
<b>WICHTIG FÜR MARIADB:</b> (https://kofler.info/root-login-problem-mit-mariadb/), weil als plugin hier immer nur "unix_socket" drinsteht.
<pre>
update mysql.user set plugin='' where user='root';
flush privileges;
</pre>
</pre>



Aktuelle Version vom 18. April 2020, 13:55 Uhr

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