Avete dimenticato mai la vostra parola d'accesso della radice di MySQL? È una di quelle cose che accade appena malgrado le precauzioni che numerose una potrebbe prendere. Di conseguenza, siete locked dal vostro assistente della base di dati. Non potete generare le nuove basi di dati e siete andati con poco controllo sopra il dichiarare del vostro assistente della base di dati. In tali situazioni che sanno riguadagnare la radice accedi a al vostro assistente della base di dati viene in pratico. Così qui è che cosa potete fare per ripristinare la parola d'accesso per l'utente della radice in MySQL sia su Windows che su Linux.
Utenti di Windows:
Inizio attività al vostro assistente come il coordinatore. Uccida l'assistente di MySQL se sta funzionando. Per fare questo avete bisogno del Responsabile di servizi di Windows, in modo da scatti sopra Inizi il menu, allora vada al Pannello di controllo, allora al Attrezzi amministrativie prescelto Servizi. Qui cerchi l'assistente di MySQL ed arrestilo. Se non è elencato là e MySQL è finchè farlo funzionare significa che MySQL non sta funzionando come servizio. In quel caso dovete caricare il responsabile di operazione di cui dovreste potere accedere a usando la combinazione chiave Ctrl+Alt+Del. Ora uccida il processo di MySQL.
Con il processo di MySQL arrestato voi debba forzare un cambiamento delle parole d'accesso su MySQL usando una combinazione del AGGIORNAMENTO e ROSSORE opzioni. Così lanci il vostro sistema di editazione testi favorito e generi una nuova lima. Digiti il seguente testo nella lima che sostituisce “NewMySQLPassword„ con la vostra nuova parola d'accesso:
AGGIORNAMENTO mysql.user Password=PASSWORD STABILITO („ NewMySQLPassword„) DOVE User=' radice';
PRIVILEGI A LIVELLO;
Che cosa la prima linea è che aggiorna il valore del campo “parola d'accesso„ nella tabella mysql.user per l'utente “la radice„ “NewMySQLPassword„. La seconda linea irriga il vecchio insieme dei privilegi e che si assicura che la vostra nuova parola d'accesso è usata dappertutto. Risparmi questo testo As C:\mysql _reset.txt.
Dopo, dovete avviare il vostro assistente di MySQL passare questa lima come parametro di configurazione. Lanci un terminale andando al Inizi il menu, allora a Funzionamentoed allora scriva cmd ed il colpo entra. Ora introduca il seguente comando:
C:\mysql\bin\mysqld - NT --init-file= C:\mysql _reset.txt
Una volta che l'assistente è fatto che inizia la cancellazione la lima C:\mysql _reset.txt. La vostra parola d'accesso della radice di MySQL dovrebbe ora essere ripristinata. Ora ricominci ancora il vostro assistente di MySQL. Vada ancora di nuovo al responsabile di servizi di Windows fare quello. La vostra nuova parola d'accesso della radice di MySQL dovrebbe ora funzionare per voi.
Utenti di 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