Reset the Root Password of MySQL Server Reimpostare la password di root di MySQL Server
By default, MySQL Server will be installed with root superuser without any password. Per impostazione predefinita, MySQL Server verrà installato con radice di superutente senza alcuna password. You can connect to MySQL server as root without requiring password or by keying in blank password. È possibile connettersi al server MySQL come root senza bisogno di password o di digitare password vuota. However, if you have set the password for root and forget or unable to recall the password, then you will need to reset the root password for MySQL. Tuttavia, se avete impostato la password di root e dimenticare o non sia in grado di ricordare la password, quindi hai bisogno di reimpostare la password di root per MySQL.
MySQL Reference Manual has detail steps on how to reset password for root which are as below: MySQL Reference Manual ha passi dettaglio su come reimpostare la password di root che sono le seguenti:
The procedure under Windows: La procedura di sotto Windows:
- Log on to the Windows system where MySQL is running as Administrator. Accedere al sistema di Windows in cui è in esecuzione MySQL come amministratore.
- Stop the MySQL server if it is running. Arrestare il server MySQL se è in esecuzione. For a server that is running as a Windows service, go to the Services manager: Per un server che esegue come servizio di Windows, aprire la Gestione Servizi:
Start Menu -> Control Panel -> Administrative Tools -> Services Menu Start -> Pannello di controllo -> Strumenti di amministrazione -> Servizi
Then find the MySQL service in the list, and stop it. Quindi trovare il servizio MySQL nella lista, e fermarla.
If your server is not running as a service, you may need to use the Task Manager to force it to stop. Se il tuo server non è in esecuzione come un servizio, potrebbe essere necessario utilizzare il Task Manager per forza di smettere.
- Create a text file and place the following command within it on a single line: Creare un file di testo e inserisci il seguente comando al suo interno su una sola riga:
SET PASSWORD FOR ‘root’@'localhost’ = PASSWORD(’MyNewPassword’); SET password per 'root' @ 'localhost' = password ( 'MyNewPassword');
Save the file with any name. Salvare il file con un nome qualsiasi. For this example the file will be C:\mysql-init.txt. Per questo esempio il file sarà C: \ mysql-init.txt.
- Open a console window to get to the DOS command prompt: Aprire una finestra di console a raggiungere il prompt dei comandi DOS:
Start Menu -> Run -> cmd Menu Start -> Esegui -> cmd
- If MySQL is installed in C:\mysql. Se MySQL è installato in C: \ mysql. If MySQL is installed in another location, adjust the following commands accordingly. Se MySQL è installato in un'altra posizione, regolare i seguenti comandi di conseguenza.
At the DOS command prompt, execute this command: Al prompt dei comandi DOS, eseguire il comando:
C:\> C:\mysql\bin\mysqld-nt –init-file=C:\mysql-init.txt C: \> C: \ mysql \ bin \ mysqld-NT-init-file = C: \ mysql-init.txt
The contents of the file named by the –init-file option are executed at server startup, changing the root password. Il contenuto del file chiamato dal-init-file vengono eseguiti all'avvio del server, modificare la password di root. After the server has started successfully, you should delete C:\mysql-init.txt. Dopo il server ha avviato con successo, si dovrebbero eliminare C: \ mysql-init.txt.
If you installed MySQL using the MySQL Installation Wizard, you may need to specify a –defaults-file option: Se si è installato utilizzando MySQL MySQL Installazione guidata, potrebbe essere necessario specificare un-defaults-file opzione:
C:\> “C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt.exe” C: \> "C: \ Program Files \ MySQL \ MySQL Server 5,0 \ bin \ mysqld-NT.EXE"
–defaults-file=”C:\Program Files\MySQL\MySQL Server 5.0\my.ini” - Defaults-file = "C: \ Program Files \ MySQL \ MySQL Server 5,0 \ my.ini"
–init-file=C:\mysql-init.txt - Init-file = C: \ mysql-init.txtThe appropriate –defaults-file setting can be found using the Services Manager: Le opportune-defaults-file di impostazione può essere trovato usando la Gestione Servizi:
Start Menu -> Control Panel -> Administrative Tools -> Services Menu Start -> Pannello di controllo -> Strumenti di amministrazione -> Servizi
Find the MySQL service in the list, right-click on it, and choose the Properties option. Trovare il servizio MySQL nell'elenco, fai clic destro su di esso e scegliere Proprietà. The Path to executable field contains the –defaults-file setting. Il Sentiero alla eseguibile campo contiene il-defaults-file. Be sure to supply the –init-file argument with the full system path to the file, regardless of your current working directory Essere sicuri di fornire i-init-file argomento con l'intero sistema percorso del file, indipendentemente dalla vostra directory di lavoro corrente
- Stop the MySQL server, then restart it in normal mode again. Arrestare il server MySQL, riavviarlo in modalità normale. If the MySQL server is ran as a service, start it from the Windows Services window. Se il server MySQL è stato eseguito come servizio, iniziare dalla finestra Servizi di Windows. If you start the server manually, use whatever command you normally use. Se si avvia il server manualmente, utilizzare qualunque comando normalmente si usa.
- Connect to MySQL server by using the new password. Connettersi al server MySQL utilizzando la nuova password.
For Unix environment, the procedure for resetting the root password is as follows: Per Unix ambiente, la procedura per reimpostare la password di root è la seguente:
- Log on to the Unix system as either the Unix root user or as the same user that the mysqld server runs as. Accedere al sistema Unix come sia Unix utente root o come lo stesso utente che l'mysqld server viene eseguito come.
- Locate the .pid file that contains the server’s process ID. Individuare il. Pid file che contiene il processo del server ID. The exact location and name of this file depend on your distribution, hostname, and configuration. L'esatta posizione e il nome di questo file dipendono dalla vostra distribuzione, hostname, e la configurazione. Common locations are /var/lib/mysql/, /var/run/mysqld/, and /usr/local/mysql/data/. I percorsi comuni sono / var / lib / mysql /, / var / run / mysqld / e / usr / local / mysql / data /. Generally, the filename has the extension of .pid and begins with either mysqld or the system’s hostname. In generale, il nome del file ha l'estensione. Pid e inizia con una mysqld o il nome host del sistema.
Stop the MySQL server by sending a normal kill (not kill -9) to the mysqld process, using the pathname of the .pid file in the following command: Arrestare il server MySQL tramite l'invio di un normale uccidere (non uccidere -9) per il processo mysqld, utilizzando il percorso di. Pid file nel seguente comando:
shell> kill `cat /mysql-data-directory/host_name.pid` shell> uccidere `cat / mysql-data-directory/host_name.pid`
Note the use of backticks rather than forward quotes with the cat command; these cause the output of cat to be substituted into the kill command. Nota l'uso di backticks piuttosto che cita avanti con il comando cat; questi provocare l'uscita del gatto di essere sostituito nel comando kill.
- Create a text file and place the following command within it on a single line: Creare un file di testo e inserisci il seguente comando al suo interno su una sola riga:
SET PASSWORD FOR ‘root’@'localhost’ = PASSWORD(’MyNewPassword’); SET password per 'root' @ 'localhost' = password ( 'MyNewPassword');
Save the file with any name. Salvare il file con un nome qualsiasi. For this example the file will be ~/mysql-init. Per questo esempio il file verrà ~ / mysql-init.
- Restart the MySQL server with the special –init-file=~/mysql-init option: Riavviare il server MySQL con la speciale-init-file = ~ / mysql-init opzione:
shell> mysqld_safe –init-file=~/mysql-init & shell> mysqld_safe-init-file = ~ / mysql-init &
The contents of the init-file are executed at server startup, changing the root password. Il contenuto del file init sono eseguiti all'avvio del server, modificare la password di root. After the server has started successfully you should delete ~/mysql-init. Dopo il server ha avviato con successo devi eliminare ~ / mysql-init.
- Connect to MySQL server by using the new password. Connettersi al server MySQL utilizzando la nuova password.
Alternatively, on any platform, mysql client can be used to set the new password, althought it’s less secure way of resetting the password (detailed instruction In alternativa, su qualsiasi piattaforma, mysql client può essere utilizzata per impostare la nuova password, anche se è meno sicuro modo di reimpostazione della password (istruzioni dettagliate here qui ):
- Stop mysqld and restart it with the –skip-grant-tables –user=root options (Windows users omit the –user=root portion). Mysqld interrompere e riavviare con il-skip-concessione-tabelle-user = root opzioni (gli utenti di Windows omettere l'utente root = porzione).
- Connect to the mysqld server with this command: Connettersi al server mysqld con questo comando:
shell> mysql -u root shell> mysql-u root
- Issue the following statements in the mysql client: Problema seguenti dichiarazioni in mysql client:
mysql> UPDATE mysql.user SET Password=PASSWORD(’newpwd’) mysql> UPDATE mysql.user SET Password = password ( 'newpwd')
-> WHERE User=’root’; --> Dove user = 'root';
mysql> FLUSH PRIVILEGES; mysql> flush privileges;Replace ‘newpwd’ with the actual root password that you want to use. Sostituire 'newpwd' con l'attuale password di root che si desidera utilizzare.
- You should be able to connect using the new password. Dovreste essere in grado di collegarsi utilizzando la nuova password.
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. IMPORTANTE: Questa è una pagina tradotta macchina che è fornito "così com'è" senza alcuna garanzia. Machine translation may be difficult to understand. Traduzione automatica può essere difficile da capire. Please refer to Si prega di fare riferimento a original English article articolo originale in lingua inglese whenever possible. quando possibile.
Share and contribute or get technical support and help at Condividere e contribuire o ottenere supporto tecnico e assistenza in My Digital Life Forums La mia vita digitale Forum .
Related Articles Articoli correlati
- Change and Reset MySQL root Password Reset cambiamento e MySQL root Password
- Installing Web Server in FreeBSD 6.0 with Apache 2.2, MySQL 5.0 and PHP 5 - Part 3 L'installazione di server Web in FreeBSD 6,0 con Apache 2,2, 5,0 MySQL e PHP 5 - Parte 3
- Install Web Server in Windows XP with Apache2, PHP5 and MySQL4 - Part 4 Installare server Web in Windows XP con Apache2, PHP5 e MySQL4 - Parte 4
- Check and Optimize MySQL Database Automatically with Crontab/Cron Controllare e ottimizzare la base di dati di MySQL automaticamente con crontab / cron
- Using phpMyAdmin for Effective MySQL Management in Windows XP Utilizzando phpMyAdmin per un'efficace gestione di MySQL in Windows XP
- Fix for Munin MySQL Monitoring Plugin Graph Not Showing or Blank Correzione per il monitoraggio Munin mysql plug grafico non mostra o vuoto
- How to Reset WordPress Password to Recover Forgotten Secret Come reimpostare wordpress per recuperare la password dimenticata segreto
- How to Reset AdSense Password Not Associated with Google Account Come reimpostare la password di AdSense non sono associati ad account Google
- Disable Direct Root Login and User Access via SSH to Server Disabilitare il login root diretto e accesso utente tramite la connessione SSH al server
- Install phpBB 2 in Windows XP running on Apache 2, PHP 5 and MySQL 4 Installare phpBB 2 in Windows XP in esecuzione su Apache 2, PHP 5 e MySQL 4









June 6th, 2006 18:12 6 giugno 2006 18:12
[...] Other then the ways specified here to reset and change the root password for mySQL database in the case that the password is forgotten or lost, the following instructions explain in details the alternative way at the last part of the guide, where no additional file needs to be created: [...] [...] Altri poi i modi specificati qui per reimpostare e cambiare la password di root per MySQL banca dati nel caso in cui la password viene dimenticata o smarrita, le seguenti istruzioni spiegano nei dettagli il modo alternativo durante l'ultima parte della guida, dove altri file non deve essere creata: [...]
October 8th, 2007 03:47 8 ottobre 2007 03:47
You should add –verbose –console to the command in step 5. Si dovrebbe aggiungere-verbose-console per il comando nel passaggio 5. I got a error because of a copy and paste issue that include a quote of the wrong type but there’s no error feedback without the –console. Ho ricevuto un errore a causa di un copia e incolla problema che includono una citazione del tipo sbagliato, ma non vi è alcun errore di feedback senza la console. Also, the -console to stop the server with CTRL-C under windows, not sure about linux. Inoltre, la console per arrestare il server con CTRL-C sotto Windows, non è sicuro di Linux.
-Mike - Mike
April 23rd, 2008 23:38 23 aprile 2008 23:38
This isn’t correct. Questo non è corretto. The syntax should be “–init” not “-init”. La sintassi dovrebbe essere "-init" non "-init".
April 23rd, 2008 23:39 23 aprile 2008 23:39
Ah and now that I’ve posted I see the problem. Ah e ora che ho postato vedo il problema. This site is disallowing double “-”. Questo sito è doppio rifiutare "-". It’s being escaped or something. E 'in corso o qualcosa di escape.
Well dear reader, just now that “-init” should have TWO dashes (hyphens), not one. Beh caro lettore, proprio ora che "-init" dovrebbe avere due trattini (trattini), non uno.
April 23rd, 2008 23:39 23 aprile 2008 23:39
Gah. “know” not “now”. "Sapere" non "ora". I’m going for coffee now. Io vado per il caffè.
April 24th, 2008 10:05 24 aprile 2008 10:05
Dude, Tipo,
Didn’t see these comments while reading the article, but I figured out the double-hyphen syntax by trial and error. Non vedere questi commenti durante la lettura della articolo, ma ho dato il doppio trattino sintassi di prove ed errori.
Anyway you saved my Life by putting this documentation on the Net !! Comunque hai salvato la mia vita di questa documentazione messa in rete! A thousand thanks ! Mille grazie! -Rob Rob -
April 25th, 2008 01:37 25 aprile 2008 01:37
There is a typo on the mysqld startup script. Non vi è un errore di stampa sulla mysqld script di avvio.
The correct command requires TWO dashes before the parameter setting. Il comando corretto richiede due trattini prima che il parametro di impostazione.
The correct command is (note TWO dashes before skip-grant-tables): Il comando corretto è (nota DUE trattini prima skip-concessione-tabelle):
mysqld_safe –skip-grant-tables mysqld_safe-skip-concessione-tabelle
July 31st, 2008 21:18 31 luglio 2008 21:18
Procdure to reset root password in MySQL [RedHat & Fedora] Procdure per reimpostare la password di root in MySQL [RedHat e Fedora Core]
====================================================== ================================================== ====
Step-1 Passo-1
[root@redhat~]#killall mysqld [root @ redhat ~] # killall mysqld
[root@redhat~]#/usr/libexec/mysqld –skip-grant-tables –user=root & [root @ redhat ~] # / usr / libexec / mysqld-skip-concessione-tabelle-user = root &
====================================================== ================================================== ====
Step-2 (In MySQL) Step-2 (in MySQL)
[root@redhat~]#mysql [root @ redhat ~] # mysql
use mysql; use mysql;
update user set password=password(”newpassowrd”) where user=”root”; aggiornamento utente a configurare una password = password ( "newpassowrd") dove l'utente = "root";
flush privileges; flush privileges;
exit; uscita;
====================================================== ================================================== ====
Step-3 Passo-3
[root@redhat~]#killall mysqld [root @ redhat ~] # killall mysqld
[root@redhat~]#/etc/init.d/mysqld start [root @ redhat ~] # / etc / init.d / mysqld inizio
There you go Ci si va
August 14th, 2008 10:47 14 agosto 2008 10:47
phpmyadmin phpMyAdmin