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

Aus Thoms Wiki
Zur Navigation springenZur Suche springen
all>Verkehrsminister
Die Seite wurde neu angelegt: „taken from https://www.ostechnix.com/how-to-reset-mysql-or-mariadb-root-password/ DB stoppen <pre> systemctl stop mysql oder systemctl stop mariadb oder a…“
 
all>Verkehrsminister
Keine Bearbeitungszusammenfassung
Zeile 49: Zeile 49:
mysql -u root -p
mysql -u root -p
</pre>
</pre>
[[Kategorie:Datenbank]]

Version vom 12. April 2019, 20:21 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

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