Have you ever forgotten your MySQL root password? Vai jūs kādreiz esat aizmirsis savu MySQL root paroli? It's one of those things that just happens despite the numerous precautions one might take. Tā ir viena no tām lietām, kas vienkārši notiek, kaut daudzi piesardzības varētu ņemt. As a result, you are locked out of your database server. Kā rezultātā, jums ir izslēgt no datu bāzes serveri. You can't create new databases and are left with little control over the state of your database server. Jūs nevarat veidot jaunas datubāzes un ir palicis maz kontroles pār stāvoklis datu bāzes serveri. In such situations knowing how to regain root access to your database server comes in handy. Šādās situācijās zinot, kā atgūt root piekļūt jūsu datu bāzes servera nāk pa rokai. So here's what you can do to reset the password for the root user in MySQL on both Windows and Linux. Tātad, šeit ir tas, ko jūs varat darīt, lai atjaunotu paroli root lietotāja MySQL gan Windows un Linux.
Windows Users: Windows lietotājiem:
Log on to your server as the Administrator. Piesakieties savā serverī kā administrators. Kill the MySQL server if it's running. Nogalināt MySQL serveri, ja tas darbojas. To do this you need the Windows Services Manager , so click on the Start Menu , then go to the Control Panel , then to the Administrative Tools , and select Services . Lai to izdarītu nepieciešams Windows Services Manager, tādēļ noklikšķiniet uz Start Menu, tad ejiet uz Control Panel, pēc tam Administrative Tools, un izvēlieties Pakalpojumi. Here look for the MySQL server and stop it. Šeit meklēt MySQL servera un apturēšanai. If it's not listed there and MySQL is till running it means that MySQL is not running as a service. Ja tas nav tur minētajām un MySQL ir līdz darbojas tas nozīmē, ka MySQL nedarbojas kā serviss. In that case you need to load the Task Manager which you should be able to access using the key combination of Ctrl+Alt+Del . Šādā gadījumā jums ir nepieciešams ielādēt Task Manager, ko jums vajadzētu būt spējīgam piekļūt, izmantojot taustiņu kombināciju Ctrl + Alt + Del. Now kill the MySQL process. Tagad nogalināt MySQL procesu.
With the MySQL process stopped you need to force a change of passwords on MySQL using a combination of the UPDATE and FLUSH options. Ar MySQL process apstājās jums piespiest paroļu maiņu MySQL, lietojot kombināciju UPDATE un FLUSH iespējas. So launch your favorite text editor and create a new file. Lai uzsāktu savu iecienītāko teksta redaktoru un izveidotu jaunu failu. Enter the following text into the file replacing “NewMySQLPassword” with your new password: Ievadiet šādu tekstu failā, aizstājot vārdu "NewMySQLPassword" ar savu jauno paroli:
UPDATE mysql.user SET Password=PASSWORD(”NewMySQLPassword”) WHERE User='root'; UPDATE mysql.user SET Password = PASSWORD ( "NewMySQLPassword") WHERE user = 'root';
FLUSH PRIVILEGES; FLUSH privilēģijas;
What the first line does is that it updates the value of the field “Password” in the table mysql.user for the user “root” to “NewMySQLPassword”. Ko pirmo rindiņu tas ir tas, ka tas aktualizē vērtību laukā "Parole" šajā tabulā mysql.user lai lietotājs "root" uz "NewMySQLPassword". The second line flushes the old set of privileges and makes sure your new password is used everywhere. Otrajā rindā viļņi veco komplektu privilēģijas un nodrošina jauno paroli izmanto visur. Save this text as C:\mysql_reset.txt . Saglabāt šo tekstu kā C: \ mysql_reset.txt.
Next, you need to start your MySQL server passing this file as a configuration parameter. Nākamo, jums ir nepieciešams, lai sāktu savu MySQL serveri, kas iet šo failu kā konfigurācijas parametru. Launch a terminal by going to the Start Menu , then to Run , and then type cmd and hit Enter. Uzsākt termināls, dodoties uz Start Menu, tad, lai palaistu, un pēc tam ierakstiet cmd un nospiediet Enter. Now enter the following command: Tagad ievadiet šādu komandu:
C:\mysql\bin\mysqld-nt --init-file=C:\mysql_reset.txt C: \ mysql \ bin \ mysqld-nt - init-file = C: \ mysql_reset.txt
Once the server is done starting delete the file C:\mysql_reset.txt . Kad serveris ir jādara, sākot izdzēst failu C: \ mysql_reset.txt. Your MySQL root password should be reset now. Jūsu MySQL root parole ir atiestatīšanas tagad. Now restart your MySQL server again. Tagad restart Jūsu MySQL serveris vēlreiz. Go back to the Windows Services Manager again to do that. Iet atpakaļ Windows Services Manager atkal to darīt. Your new MySQL root password should work for you now. Jūsu jaunais MySQL root parole ir jāstrādā, lai jūs tagad.
Linux Users: Linux Users:
Log on to your Linux machine as the root user. Piesakieties savā Linux mašīna kā root lietotājam. 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. Posmi atgriezi MySQL root parole ir apturēt MySQL serveri, restartējiet to bez atļaujas aktīvas tāpēc jūs varat ieiet MySQL kā root bez paroles, kas jauno paroli un pēc tam restartējiet to parasti. Here's how you do it. Lūk, kā jūs to darīt. First, stop the MySQL server: Pirmkārt, apturēt MySQL serveri:
# /etc/init.d/mysql stop # / 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: Tagad sāk MySQL serveri, izmantojot - skip-dotāciju tabulas variants, kas ilgs serveri bez kravas atļauju iestatījumus:
# mysqld_safe --skip-grant-tables & # Mysqld_safe - skip-dotāciju galdi &
The & option at the end makes the command you have executed run as a background process. & Opciju beigās padara komandas ir izpildījušas darboties kā fona procesu. Now log on to your MySQL server as root: Tagad pieslēgties savam MySQL serverim kā root:
# mysql -u root # Mysql-u root
It should allow you in without prompting for a password. Tas ļaus jums bez pamudinot uz paroli. The following steps will set the new password: Šādi pasākumi, kas jauno paroli:
mysql> use mysql; mysql> Lietot mysql;
mysql> update user set password=PASSWORD(”NewMySQLPassword”) where User='root'; mysql> update lietotāja iestatītā parole = PASSWORD ( "NewMySQLPassword"), kur user = 'root';
mysql> flush privileges; mysql> flush privilēģijas;
mysql> quit mysql> Iziet
Replace “NewMySQLPassword” with your own password. Aizstāt vārdus "NewMySQLPassword" ar savu paroli. Here's what happens here. Lūk, kas notiek šeit. The first line selects the MySQL configuration tables. Pirmā līnija izvēlas MySQL konfigurācijas tabulas. The second line updates the value of the field “Password” for the user “root” to “NewMySQLPassword”. Otrajā rindā atjauninājumi laukā "Parole" vērtība lietotājs "root" uz "NewMySQLPassword". The third line flushes the old set of privileges and makes sure your new password is used everywhere. Trešajā rindā viļņi veco komplektu privilēģijas un nodrošina jauno paroli izmanto visur. Now, the last step is to restart the server normally and use your new root password to log in: Tagad pēdējais solis ir restart serveri parasti un izmantot savu jauno root paroli, lai pieteiktos:
# /etc/init.d/mysql stop # / Etc / init.d / mysql stop
# /etc/init.d/mysql start # / Etc / init.d / mysql sākums
# mysql -u root -pNewMySQLPassword # Mysql-u root-pNewMySQLPassword
Congratulations, your new MySQL root password is set and your MySQL server is ready to be used again. Apsveicam, jūsu jauno MySQL root parole ir iestatīta un Jūsu MySQL serveris ir gatavs izmantot atkārtoti. Remember to update all your applications to use this password if you are using it anywhere. Atcerieties, lai atjauninātu visus savus pieteikumus, lai izmantotu šo paroli, ja esat to izmantot visur.























{ 5 comments… read them below or (5 komentāri ... lasīt tos zem vai add one pievienot vienu } )
OI como faço para recuperar a senha do root do linux Kurumin OI como faço para Recuperar paroli do saknes do linux Kurumin
http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html
BTW the syntax above is missing a – BTW sintakse iepriekš ir pazudis --
There should be a double minus sign in front of the init. Ir jābūt dubultā mīnus zīmi priekšā init. Do that and the commands work fine. Darīt un komandas darbu, naudas sodu. Looking at it, its missing elsewhere too – so might be your blog s/w converting double en dash to em dash Skatoties uz to, tās trūkst arī citur - tā varētu būt jūsu emuāru s / w konvertējošā dubultā en dash ar domuzīmi
C:\mysql\bin\mysqld-nt -–init-file=C:\mysql_reset.txt 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. Paldies Manfred - tev taisnība, tas bija konvertēt dubulto domuzīmes vērā vienu svītru. It's all fixed now. Tas viss ir noteikts šobrīd. Thanks again! Thanks again!
Much simpler than the “official” version pointed out by xxxxxxx. Daudz vienkāršāk, nekā "oficiālā" versija norādīja xxxxxxx. Nicely written, thanks. Labi uzrakstīts, thanks.
Leave a Comment Leave Comment