Reset the MySQL root password on Ubuntu Linux

Kürzlich hatte ich das Problem, dass ich das Passwort für den root Benutzer meines MySQL-Servers vergessen habe. Da ich aber die Daten nicht verlieren wollte war eine Neuinstallation keine Option.

Hier eine kurze Step-by-Step Anleitung um das root Passwort des MySQL-Servers zurück zu setzen.

  1. 1. MySQL Server stoppen
    sudo /etc/init.d/mysql stop
  2. 2. MySQL Server ohne Rechteprüfung starten
    sudo mysqld --skip-grant-tables &
  3. 3.Als root einloggen und die DB mysql wählen
    mysql -u root mysql
  4. 4. Passwort für root zurücksetzen
    UPDATE user SET Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root'; FLUSH PRIVILEGES; exit;
  5. 5. Server neu starten
    sudo /etc/init.d/mysql restart

Dies ist vielleicht nicht die sicherste Methode, jedoch für meine Entwicklerkiste reichts.

Tagged with: , , ,
Posted in Other, Unix
One comment on “Reset the MySQL root password on Ubuntu Linux
  1. Bert says:

    Wie heisst das Plugin rechts ? Das brauche ich!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>