Hebt u ooit uw MySQL wortelwachtwoord vergeten? Het is één van die dingen die enkel ondanks de talrijke voorzorgsmaatregelen gebeurt men zou kunnen nemen. Dientengevolge, bent u gesloten uit uw gegevensbestandserver. U kunt geen nieuwe gegevensbestanden creëren en met weinig controle over de staat van uw gegevensbestandserver verlaten. In dergelijke situaties die het weten hoe te worteltoegang tot uw gegevensbestand te herwinnen komt de server in handig. Zo hier is wat u kunt doen het wachtwoord voor de wortelgebruiker in MySQL op zowel Vensters als Linux terugstellen.
De Gebruikers van vensters:
Opening van een sessie aan uw server als Beheerder. Dood de server MySQL als het loopt. Om dit te doen hebt u nodig De Manager van de Diensten van vensters, klik zo op Het Menu van het begin, ga dan naar Het Comité van de controle, dan aan Administratieve Hulpmiddelen, en uitgezocht De diensten. Zoek hier de server MySQL en houd het tegen. Als het niet daar vermeld is en MySQL is tot lopend betekent het dat MySQL niet als dienst loopt. In dat geval moet u de Manager van de Taak laden u tot het gebruiken van de belangrijkste combinatie zou moeten kunnen toegang hebben waarvan Ctrl+Alt+Del. Dood nu het proces MySQL.
Met hield het MySQL proces u moet een verandering van wachtwoorden op MySQL dwingen gebruikend een combinatie van op UPDATE en VLOED opties. Lanceer zo uw favoriete tekstredacteur en cre�ër een nieuw dossier. Ga de volgende tekst in het dossier in dat „NewMySQLPassword“ vervangt met uw nieuw wachtwoord:
UPDATE mysql.user VASTGESTELDE Password=PASSWORD (“ NewMySQLPassword“) WAAR User=' wortel';
GELIJKE VOORRECHTEN;
Wat de eerste lijn doet is dat het de waarde van het gebied „Wachtwoord“ in de lijst mysql.user voor de gebruiker „wortel“ aan „NewMySQLPassword“ bijwerkt. De tweede lijn spoelt de oude reeks voorrechten en zorgt ervoor uw nieuw wachtwoord overal wordt gebruikt. Sparen deze tekst zoals C:\mysql _reset.txt.
Daarna, moet u uw server beginnen MySQL dit dossier als configuratieparameter over te gaan. Lanceer een terminal door naar te gaan Het Menu van het begin, dan aan Looppas, en toen type cmd en de klap gaat binnen. Ga nu het volgende bevel in:
C:\mysql\bin\mysqld - nt --init-file= C:\mysql _reset.txt
Zodra de server gedaane aanvang is schrap het dossier C:\mysql _reset.txt. Uw MySQL wortelwachtwoord zou nu moeten worden teruggesteld. Begin opnieuw nu uw server MySQL opnieuw. Ga opnieuw terug aan de Manager van de Diensten van Vensters om dat te doen. Uw nieuw MySQL wortelwachtwoord zou voor u nu moeten werken.
De Gebruikers van Linux:
Log on to your Linux machine as the root user. The steps involved in resetting the MySQL root password are to stop the MySQL server, restart it without the permissions active so you can log into MySQL as root without a password, set a new password, and then restart it normally. Here’s how you do it. First, stop the MySQL server:
# /etc/init.d/mysql stop
Now start the MySQL server using the --skip-grant-tables option, which will run the server without loading the permissions settings:
# mysqld_safe --skip-grant-tables &
The & option at the end makes the command you have executed run as a background process. Now log on to your MySQL server as root:
# mysql -u root
It should allow you in without prompting for a password. The following steps will set the new password:
mysql> use mysql;
mysql> update user set password=PASSWORD(”NewMySQLPassword”) where User=’root’;
mysql> flush privileges;
mysql> quit
Replace “NewMySQLPassword” with your own password. Here’s what happens here. The first line selects the MySQL configuration tables. The second line updates the value of the field “Password” for the user “root” to “NewMySQLPassword”. The third line flushes the old set of privileges and makes sure your new password is used everywhere. Now, the last step is to restart the server normally and use your new root password to log in:
# /etc/init.d/mysql stop
# /etc/init.d/mysql start
# mysql -u root -pNewMySQLPassword
Congratulations, your new MySQL root password is set and your MySQL server is ready to be used again. Remember to update all your applications to use this password if you are using it anywhere.























{ 4 comments… read them below or add one }
OI como faço para recuperar a senha do root do linux Kurumin
http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html
BTW the syntax above is missing a -
There should be a double minus sign in front of the init. Do that and the commands work fine. Looking at it, its missing elsewhere too - so might be your blog s/w converting double en dash to em dash
C:\mysql\bin\mysqld-nt -–init-file=C:\mysql_reset.txt
Thanks Manfred - you’re right, it did convert the double-dashes into a single dash. It’s all fixed now. Thanks again!
Leave a Comment