Have you ever forgotten your MySQL root password? Už ste niekedy zabudli MySQL root heslo? It's one of those things that just happens despite the numerous precautions one might take. Je to jedna z tých vecí, ktoré sa to stane aj cez početné opatrenia, jeden by mohol prijať. As a result, you are locked out of your database server. V dôsledku toho, že nie uzamknuté z databázového servera. You can't create new databases and are left with little control over the state of your database server. Nemôžete vytvárať nové databázy a sú ponechané len malú kontrolu nad stavom vášho databázového servera. In such situations knowing how to regain root access to your database server comes in handy. V takých situáciách vedieť, ako znovu získať root prístup k databáze servera príde vhod. So here's what you can do to reset the password for the root user in MySQL on both Windows and Linux. Tak tu je to, čo môžete urobiť pre to, resetovať heslo pre užívateľa root v MySQL na Windows i Linux.
Windows Users: Windows User:
Log on to your server as the Administrator. Prihláste sa na server ako správca. Kill the MySQL server if it's running. Kill MySQL server, ak je to beží. 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 . K tomu budete potrebovať Windows Services Manager, tak kliknite na Start Menu, potom choďte na Ovládací panel, potom na položku Nástroje na správu a vyberte Služby. Here look for the MySQL server and stop it. Tu hľadajte server MySQL a zastaviť. If it's not listed there and MySQL is till running it means that MySQL is not running as a service. Ak nie je v ňom uvedené, a MySQL je do prevádzky znamená to, že MySQL nie je spustený ako služba. 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 . V takom prípade budete musieť zaviesť Správca úloh, ktoré by ste mali mať možnosť prístupu pomocou kombinácie kláves Ctrl + Alt + Del. Now kill the MySQL process. Teraz zabiť 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. S procesom MySQL zastavil budete musieť vynútiť zmenu hesla na MySQL pomocou kombinácie UPDATE a FLUSH možnosti. So launch your favorite text editor and create a new file. Takže spustiť váš obľúbený textový editor a vytvorte nový súbor. Enter the following text into the file replacing “NewMySQLPassword” with your new password: Zadajte nasledujúci text do súboru nahradí "NewMySQLPassword" s pomocou nového hesla:
UPDATE mysql.user SET Password=PASSWORD(”NewMySQLPassword”) WHERE User='root'; UPDATE mysql.user SET Password = PASSWORD ( "NewMySQLPassword") KDE User = 'root';
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
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”. Čo robí na prvom riadku je to, že aktualizuje hodnotu poľa "Heslo" v tabuľke mysql.user pre používateľa "root" na "NewMySQLPassword". The second line flushes the old set of privileges and makes sure your new password is used everywhere. Druhý riadok spláchne starý súbor výsady a zaisťuje, že vaše nové heslo sa používa všade. Save this text as C:\mysql_reset.txt . Uložiť tento text C: \ mysql_reset.txt.
Next, you need to start your MySQL server passing this file as a configuration parameter. Ďalej musíte spustiť MySQL server absolvovanie tohto súboru ako konfiguračný parameter. Launch a terminal by going to the Start Menu , then to Run , and then type cmd and hit Enter. Spustenie terminálu, že prejdete do ponuky Štart, potom na položku Spustiť a zadajte príkaz cmd a stlačte kláves Enter. Now enter the following command: Teraz zadajte nasledujúci príkaz:
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 . Akonáhle server prebieha od odstrániť súbor C: \ mysql_reset.txt. Your MySQL root password should be reset now. MySQL root hesla by mala byť nová sadzba teraz. Now restart your MySQL server again. Teraz reštartujte MySQL server znova. Go back to the Windows Services Manager again to do that. Vráťte sa do Windows Services Manager znova urobiť. Your new MySQL root password should work for you now. Vaše nové heslo MySQL root by mal pracovať pre vás teraz.
Linux Users: Linux Users:
Log on to your Linux machine as the root user. Prihláste sa k počítaču Linux ako root. 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. Udalosti v resetovania MySQL root heslo na zastavenie MySQL servera, reštartovať bez oprávnenia aktívny, takže sa môžete prihlásiť do MySQL ako root bez hesla, nastaviť nové heslo, a potom ju znova spustite zvyčajným spôsobom. Here's how you do it. Tu je návod, ako to urobiť. First, stop the MySQL server: Po prvé, zastavenie MySQL servera:
# /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: Teraz spustite MySQL server pomocou - skip-grant-stoly voľby, ktorý bude prebiehať serveru bez načítania nastavenie oprávnenia:
# mysqld_safe --skip-grant-tables & # Mysqld_safe - skip-grant-tables &
The & option at the end makes the command you have executed run as a background process. & Voľby na konci je príkaz, ktorý ste vykonaný beží ako proces na pozadí. Now log on to your MySQL server as root: Teraz prihlásenie k MySQL serveru ako root:
# mysql -u root # Mysql-u root
It should allow you in without prompting for a password. To by vám malo umožniť v bez výzvy na zadanie hesla. The following steps will set the new password: Nasledujúce kroky nastaví nové heslo:
mysql> use mysql; mysql> používať mysql;
mysql> update user set password=PASSWORD(”NewMySQLPassword”) where User='root'; mysql> update užívateľovi nastaviť heslo = PASSWORD ( "NewMySQLPassword"), kde User = 'root';
mysql> flush privileges; mysql> flush privileges;
mysql> quit mysql> quit
Replace “NewMySQLPassword” with your own password. Nahradiť "NewMySQLPassword" s vlastným heslom. Here's what happens here. Tu je to, čo sa deje tu. The first line selects the MySQL configuration tables. Prvý riadok vyberie MySQL konfiguračné tabuľky. The second line updates the value of the field “Password” for the user “root” to “NewMySQLPassword”. Druhý riadok aktualizuje hodnotu poľa "Heslo" pre používateľa "root" na "NewMySQLPassword". The third line flushes the old set of privileges and makes sure your new password is used everywhere. Tretí riadok spláchne starý súbor výsady a zaisťuje, že vaše nové heslo sa používa všade. Now, the last step is to restart the server normally and use your new root password to log in: Teraz je posledným krokom je reštart servera a normálne používať nové root heslo na prihlásenie:
# /etc/init.d/mysql stop # / Etc / init.d / mysql stop
# /etc/init.d/mysql start # / Etc / init.d / mysql start
# 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. Gratulujeme, vaša nová MySQL root heslo a nastaviť si MySQL server je pripravený na opätovné použitie. Remember to update all your applications to use this password if you are using it anywhere. Nezabudnite aktualizovať všetky aplikácie používali toto heslo, ak používate to kdekoľvek.























OI como faço para recuperar a senha do root do linux Kurumin OI ako faço para Recuperar heslo do root 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 syntax nad chýba --
There should be a double minus sign in front of the init. Tam by malo byť dvojaký znamienko mínus pred init. Do that and the commands work fine. Urob to a príkazy fungovať dobre. Looking at it, its missing elsewhere too – so might be your blog s/w converting double en dash to em dash Pri pohľade na to, jeho chýbajúce aj inde - aby mohol byť váš blog s / w konverzie double en pomlčka, aby em pomlčka
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. Vďaka Manfred - máš pravdu, to previesť double-pomlčky do jediného pomlčkou. It's all fixed now. To všetko teraz opravený. Thanks again! Thanks again!
Much simpler than the “official” version pointed out by xxxxxxx. Oveľa jednoduchšie, ako "oficiálna" verzia poukázal xxxxxxx. Nicely written, thanks. Pekne písaný, vďaka.