Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Nächste Überarbeitung
Vorhergehende Überarbeitung
mysql:reset_password [2008/04/28 13:11] – angelegt geraldmysql:reset_password [2024/02/29 13:36] (aktuell) – Externe Bearbeitung 127.0.0.1
Zeile 1: Zeile 1:
 ====== MySQL: Root-Passwort zurücksetzen ====== ====== MySQL: Root-Passwort zurücksetzen ======
 +
 +Quelle((https://www.linuxmaker.com/tutorials/mysql-rootpasswor.html))
 +
 + Ab und zu kann es passieren, dass man sein Root-Passwort für den MySQL-Root vergessen hat. Um einer Neuinstallation von MySQLvorzubeugen, möchte ich hier Lösungswege zeigen, mit denen man sich wieder Zutritt zu MySQL verschaffen kann.
 +
 +
 +Grundsätzlich kann man das Rootpasswort so setzen
 +
 +  - Öffnen Sie auf dem Server eine Root-Konsole.
 +  - Geben Sie folgenden Befehl ein: 
 +
 +<code>mysqladmin --user=root --password=<altes_pw> password <neues_pw></code>
 +
 +Wenn man aber nicht mehr als Root reinkommt helfen diese zwei Wege. 
 +
 +-> Siehe quelle!!
  
 Im Falle, dass Sie Ihr MySQL-Passwort vergessen haben, können Sie folgende Kurzanleitung verwenden, um die Root-Rechte zurück zu erlangen.\\ Im Falle, dass Sie Ihr MySQL-Passwort vergessen haben, können Sie folgende Kurzanleitung verwenden, um die Root-Rechte zurück zu erlangen.\\
Zeile 17: Zeile 33:
  
 Verlassen Sie den MySQL-Client und restarten Sie Ihren MySQL-Server. Ab jetzt sollten Sie Ihr neues Passwort verwenden können. Verlassen Sie den MySQL-Client und restarten Sie Ihren MySQL-Server. Ab jetzt sollten Sie Ihr neues Passwort verwenden können.
 +
 +====== Can't start/stop mysql service ======
 +
 +Quelle((http://serverfault.com/questions/32692/cant-start-stop-mysql-service))
 +
 +===== Why this is happening =====
 +
 +This is a common problem if you do a mysql import and overwrite the mysql database itself, such as when you might be restoring from a mysqldump -A backup.
 +
 +This is a good thing: you probably want to back up all your mysql users, permissions, etc -- but it can wreak havoc with things like the debian-sys-maint user used to cleanly shutdown mysql.
 +
 +Although this new database will possibly change both the root password and the debian-sys-maint password, of course it won't automatically change the expected debian-sys-maint password in /etc/mysql/debian.cnf. In fact, unless you also backed up that file, you probably don't even know what that password is anymore!
 +
 +===== Resetting the mysql root password (optional) =====
 +
 +
 +First things first. If the mysql root password was different between old and new servers, you can use mysqladmin to fix it:
 +
 +<code>mysql -p -u root password 'newpassword'</code>
 +
 +However, when you apt-get installed mysql-server, it probably prompted you for the new mysql root password and you probably used the same one that you were using from before.
 +
 +===== Fix the debian sys maint password. =====
 +
 +So now look up the debian sys maint password that debian created for you when you installed it on the new server. (You need sudo because this should be a highly protected file.)
 +
 +<code>sudo cat /etc/mysql/debian.cnf</code>
 +
 +Now, log in to mysql using the root password you set above:
 +
 +<code>mysql -p -u root   # use your new password when prompted</code>
 +
 +Reset the password for the debian-sys-maint user and don't forget to flush privileges:
 +<code>
 +>  SET PASSWORD FOR 'debian-sys-maint'@'localhost' = PASSWORD('password_from_/etc/mysql/debian.cnf');
 +>  FLUSH PRIVILEGES;
 +>  QUIT
 +</code>
 +
 +Test to be sure it works:
 +
 +<code>sudo /etc/init.d/mysql restart</code>
 +
 +
 
Nach oben
mysql/reset_password.1209388287.txt.gz · Zuletzt geändert: 2024/02/29 13:35 (Externe Bearbeitung)
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0
DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp   Dogecoin Donations Accepted Here    DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp  DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp