Reset the Root Password of MySQL Server Root Password Reset MySQL server

By default, MySQL Server will be installed with root superuser without any password. V predvolenom nastavení bude MySQL server inštalovaný s superužívateľ root bez hesla. You can connect to MySQL server as root without requiring password or by keying in blank password. Môžete sa pripojiť k MySQL serveru ako root bez hesla alebo zadaním prázdne heslo. 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. Avšak, máte-li nastaviť heslo pre užívateľa root a zabudnúť, alebo neschopnosť spomenúť si na heslo, potom budete musieť znova nastaviť heslo root pre MySQL.

MySQL Reference Manual has detail steps on how to reset password for root which are as below: MySQL referenčná príručka sa podrobne kroky, ako resetovať heslo pre užívateľa root, ktoré sú nižšie:

The procedure under Windows: Postup do Windows:

  1. Log on to the Windows system where MySQL is running as Administrator. Prihláste sa do systému Windows, kde MySQL je spustený ako správca.
  2. Stop the MySQL server if it is running. Stop MySQL server, ak je spustená. For a server that is running as a Windows service, go to the Services manager: Pre server, ktorý beží ako služba systému Windows, prejdite na správcu služby:

    Start Menu -> Control Panel -> Administrative Tools -> Services Ponuka Štart -> Ovládací panel -> Nástroje pre správu -> Služby

    Then find the MySQL service in the list, and stop it. Potom nájsť MySQL služby v zozname, a to zastaviť.

    If your server is not running as a service, you may need to use the Task Manager to force it to stop. Ak Váš server nie je spustený ako služba, budete musieť používať Správca úloh donútiť ho, aby zastavil.

  3. Create a text file and place the following command within it on a single line: Vytvorte textový súbor a umiestniť ho do nasledujúceho príkazu na jeden riadok:

    SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPassword'); SET heslo pre používateľa 'root' @ 'localhost' = PASSWORD ( 'MyNewPassword');

    Save the file with any name. Uložte súbor s ľubovoľným názvom. For this example the file will be C:\mysql-init.txt. Pre tento príklad bude súbor C: \ mysql-init.txt.

  4. Open a console window to get to the DOS command prompt: Otvorte okno konzole sa dostať na DOS príkazového riadku:

    Start Menu -> Run -> cmd Ponuka Štart -> Spustiť -> cmd

  5. If MySQL is installed in C:\mysql. Je-li MySQL je nainštalovaný v adresári C: \ mysql. If MySQL is installed in another location, adjust the following commands accordingly. Je-li MySQL je nainštalovaný v inom umiestnení, upravte nasledujúce príkazy zodpovedajúcim spôsobom.

    At the DOS command prompt, execute this command: V DOS príkazového riadku spustiť príkaz:

    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. Obsah súboru s názvom podľa-init-file voľby sú vykonávané pri spustení servera, zmeniť heslo užívateľa root. After the server has started successfully, you should delete C:\mysql-init.txt. Potom, čo server začal úspešne, mali by ste odstrániť C: \ mysql-init.txt.

    If you installed MySQL using the MySQL Installation Wizard, you may need to specify a –defaults-file option: Ak ste inštalovali MySQL pomocou Sprievodcu inštaláciou MySQL, budete možno musieť zadať-defaults-file možnosť:

    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.txt

    The appropriate –defaults-file setting can be found using the Services Manager: Vhodné-defaults-file nastavenia možno nájsť pomocou Services Manager:

    Start Menu -> Control Panel -> Administrative Tools -> Services Ponuka Štart -> Ovládací panel -> Nástroje pre správu -> Služby

    Find the MySQL service in the list, right-click on it, and choose the Properties option. Nájsť MySQL službu v zozname, pravým-kliknite naň a vyberte voľbu Vlastnosti. The Path to executable field contains the –defaults-file setting. Cesta k spustiteľné pole obsahuje-defaults-file nastavenia. Be sure to supply the –init-file argument with the full system path to the file, regardless of your current working directory Uistite sa, že dodávky-init-file argument sa celého systému cestu k súboru, bez ohľadu na aktuálny pracovný adresár

  6. Stop the MySQL server, then restart it in normal mode again. Stop MySQL server, potom reštartovať v normálnom režime znova. If the MySQL server is ran as a service, start it from the Windows Services window. Je-li server MySQL je vedená ako službu, spustite ju z Windows Services okno. If you start the server manually, use whatever command you normally use. Máte-li server spustiť ručne, použite príkaz čokoľvek, ktorý bežne používate.
  7. Connect to MySQL server by using the new password. Pripojiť k MySQL serveru pomocou nového hesla.

For Unix environment, the procedure for resetting the root password is as follows: Pre životné prostredie Unix, postup resetovania root heslo je nasledovné:

  1. Log on to the Unix system as either the Unix root user or as the same user that the mysqld server runs as. Prihláste sa k systému Unix, či už ako používateľ root, alebo ako Unix rovnakého užívateľa, ktorý mysqld server beží ako.
  2. Locate the .pid file that contains the server's process ID. Prejdite. Pid súbor, ktorý obsahuje ID procesu servera. The exact location and name of this file depend on your distribution, hostname, and configuration. Presné umiestnenie a názov tohto súboru závisí na vašej distribúciu, hostname, a konfigurácia. Common locations are /var/lib/mysql/, /var/run/mysqld/, and /usr/local/mysql/data/. Spoločné umiestnenie je / var / lib / mysql /, / var / run / mysqld / a / usr / local / mysql / data /. Generally, the filename has the extension of .pid and begins with either mysqld or the system's hostname. Všeobecne platí, že názov súboru má príponu. Pid a začína buď mysqld alebo systému hostiteľa.

    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: Stop MySQL server zaslaním normálne zabiť (nie kill -9) na mysqld procese pomocou cesty na. Pid súbor v nasledujúci príkaz:

    shell> kill `cat /mysql-data-directory/host_name.pid` shell> kill `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. Všimnite si použitie obrátenej skôr ako dopredu cituje s mačkou príkaz, tieto príčiny výstup mačky, ktoré sa majú nahradiť na príkaz zabiť.

  3. Create a text file and place the following command within it on a single line: Vytvorte textový súbor a umiestniť ho do nasledujúceho príkazu na jeden riadok:

    SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPassword'); SET heslo pre používateľa 'root' @ 'localhost' = PASSWORD ( 'MyNewPassword');

    Save the file with any name. Uložte súbor s ľubovoľným názvom. For this example the file will be ~/mysql-init. Pre tento príklad bude súbor ~ / mysql-init.

  4. Restart the MySQL server with the special –init-file=~/mysql-init option: Restart MySQL servera sa špeciálna-init-file = ~ / mysql-init možnosť:

    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. Obsah init-súboru sú vykonávané pri spustení servera, zmeniť heslo užívateľa root. After the server has started successfully you should delete ~/mysql-init. Potom, čo server začal úspešne, mali by ste zmazať ~ / mysql-init.

  5. Connect to MySQL server by using the new password. Pripojiť k MySQL serveru pomocou nového hesla.

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 Inak, na ľubovoľnej platforme, môže byť mysql klient slúži na nastavenie nového hesla, aj keď to je menej bezpečný spôsob resetovania hesla (podrobný návod here tady ): ):

  1. Stop mysqld and restart it with the –skip-grant-tables –user=root options (Windows users omit the –user=root portion). Stop mysqld a reštartujte ho s-skip-grant-tables-user = root voľby (používatelia Windows vynechajte-user = root časť).
  2. Connect to the mysqld server with this command: Pripojte sa k mysqld server s týmto príkazom:

    shell> mysql -u root shell> mysql-u root

  3. Issue the following statements in the mysql client: Vydanie týchto vyhlásení v mysql klientovi:

    mysql> UPDATE mysql.user SET Password=PASSWORD('newpwd') mysql> UPDATE mysql.user SET Password = PASSWORD ( 'newpwd')
    -> WHERE User='root'; -> KDE User = 'root';
    mysql> FLUSH PRIVILEGES; mysql> FLUSH PRIVILEGES;

    Replace 'newpwd' with the actual root password that you want to use. Nahradiť 'newpwd' s aktuálne root heslo, ktoré chcete použiť.

  4. You should be able to connect using the new password. Mali by ste byť schopní pripojiť sa pomocou nového hesla.

IMPORTANT : The page is machine translated and provided "as is" without warranty. Upozornenie: stránka je stroje preložené a za predpokladu, "ako je" bez záruky. Machine translation may be difficult to understand. Strojový preklad môže byť ťažké pochopiť. Please refer to Nájdete na original English article originál Anglicky artikl whenever possible. ak je to možné.

13 Responses to “Reset the Root Password of MySQL Server” 13 Reakcie na "Root Password Reset MySQL servera"

  1. Navas Navas
    April 13th, 2009 13:31 13. apríla 2009 13:31
    13 13

    I HAVE GOT XAMPP FOR PHP5 AND MYSQL BUT WHEN I OPEN THE PHPMYADMIN ITS NOT SHOWING THE LOGIN PAGE Mám XAMPP pre PHP5 a MySQL, ale keď som OPEN PHPMyAdmin IDS Nezobrazuje sa prihlasovacia stránka

  2. 網路打雜工 » FreeBSD 6.2 mysql error message网路打杂工»FreeBSD 6.2 mysql chyba
    November 4th, 2008 16:29 4 novembra 2008 16:29
    12 12

    [...] 參考資料: [...]参考资料: http://www.mydigitallife.info/2006/04/23/reset-the-root-password-of-mysql-server/ http://www.mydigitallife.info/2006/04/23/reset-the-root-password-of-mysql-server/ [...] [...]

  3. Mike Mike
    October 31st, 2008 04:17 31.říjen 2008 04:17
    11 11

    no se le entiende nada, estan malisimas las intrucciones, no son claras (tampoco soy tonto) que pena u_u no sa nada le entiende, estan malisimas las intrucciones, žiadneho syna Claras (tampoco sója Tonto) que pena u_u

  4. Rob Rob
    September 9th, 2008 07:34 9.září 2008 07:34
    10 10

    Completely wrong syntax, check the code before posting guy Naprosto chybnej syntaxe, či kód pred odoslaním chlapa

  5. Jose Jose
    August 14th, 2008 10:47 14.srpen 2008 10:47
    9 9

    phpmyadmin phpMyAdmin

  6. Kamal BAKOUR Kamal BAKOUR
    July 31st, 2008 21:18 31.července 2008 21:18
    8 8

    Procdure to reset root password in MySQL [RedHat & Fedora] Procdure obnoviť root heslo do MySQL [RedHat & Fedora]

    ====================================================== ================================================== ====
    Step-1 Krok-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-grant-tables-user = root &

    ====================================================== ================================================== ====
    Step-2 (In MySQL) Krok-2 (v MySQL)
    [root@redhat~]#mysql [root @ redhat ~] # mysql
    use mysql; využitia mysql;
    update user set password=password(”newpassowrd”) where user=”root”; Aktualizácia užívateľovi nastaviť heslo = heslo ( "newpassowrd"), kde user = "root";
    flush privileges; flush privileges;
    exit; exit;

    ====================================================== ================================================== ====
    Step-3 Krok-3
    [root@redhat~]#killall mysqld [root @ redhat ~] # killall mysqld
    [root@redhat~]#/etc/init.d/mysqld start [root @ redhat ~] # / etc / init.d / mysqld start

    There you go Tam máš :)

  7. Dan Dan
    April 25th, 2008 01:37 25.dubna 2008 01:37
    7 7

    There is a typo on the mysqld startup script. Tam je preklep na mysqld spúšťací skript.

    The correct command requires TWO dashes before the parameter setting. Správny príkaz vyžaduje dve čiarky pred nastavenie parametrov.

    The correct command is (note TWO dashes before skip-grant-tables): Správny príkaz je (všimnite si, TWO pomlčky pred skip-grant-stoly):

    mysqld_safe –skip-grant-tables mysqld_safe-skip-grant-stoly

  8. Rob Rob
    April 24th, 2008 10:05 24.dubna 2008 10:05
    6 6

    Dude, Chlapík,

    Didn't see these comments while reading the article, but I figured out the double-hyphen syntax by trial and error. Nevidel tieto pripomienky pri čítaní článku, ale ja som prišiel na to, double-pomlčku syntaxe metódou pokusov a omylov.
    Anyway you saved my Life by putting this documentation on the Net !! Každopádne ste mi zachránil život tým, že táto dokumentácia na internete! A thousand thanks ! Tis thanks! -Rob -Rob

  9. Roar Roar
    April 23rd, 2008 23:39 23.apríla 2008 23:39
    5 5

    Gah. Gah. “know” not “now”. "Vedia" nie "teraz". I'm going for coffee now. Idem na kávu teraz.

  10. Roar Roar
    April 23rd, 2008 23:39 23.apríla 2008 23:39
    4 4

    Ah and now that I've posted I see the problem. Aha, a teraz, keď som vyslaný vidím problém. This site is disallowing double “-”. Táto stránka je neuznanie double "-". It's being escaped or something. Keď som utiekol, alebo tak niečo.

    Well dear reader, just now that “-init” should have TWO dashes (hyphens), not one. No milý čitatelia, práve teraz, "-init" by mala mať dve čiarky (pomlčky), ani jeden.

  11. Roar Roar
    April 23rd, 2008 23:38 23.apríla 2008 23:38
    3 3

    This isn't correct. To nie je správne. The syntax should be “–init” not “-init”. Syntax by mala byť "-init" nie "-init".

  12. Mike Scalora Mike Scalora
    October 8th, 2007 03:47 8.října 2007 03:47
    2 2

    You should add –verbose –console to the command in step 5. Mali by ste pridať-verbose-konzola na príkaz v kroku 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. Dostal som chybu, pretože kopírovanie a vkladanie problém, ktorý obsahuje citáciu nevhodný typ ale nie je bez chýb spätná väzba-console. Also, the -console to stop the server with CTRL-C under windows, not sure about linux. Tiež-console na server zastaviť pomocou CTRL-C pod windows, linux nie sú istí.

    -Mike -Mike

  13. Change and Reset MySQL root Password » My Digital Life Zmien a Reset MySQL kmeň slová Heslo »Má Digital Life
    June 6th, 2006 18:12 6.června 2006 18:12
    1 1

    [...] 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: [...] [...] Ďalšie potom spôsobov uvedených sem reset a zmeniť rootovská heslo k MySQL databázu v prípade, že heslo je zabudol alebo stratil, Nasledujúce pokyny vysvetľujú podrobne iným spôsobom v poslednej časti sprievodcu, kde žiadne ďalšie súbor musí byť vytvorený: [...]

Leave a Reply Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> Môžete použiť tieto značky: href = "" <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime = ""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to comments feature has been disabled. Prihlásiť sa k pripomienkam funkcia bola zakázaná. To receive notification of latest comments posted, subscribe to Ak chcete dostávať oznámenia o najnovšie komentáre vyslaný, prihláste sa My Digital Life Comments RSS feed Má Digital Life Komentáre RSS or alebo register to receive zaregistrovať na new comments in daily email digest. nové komentáre v dennom email Digest.

New Articles Nové články

Incoming Search Terms for the Article Vcházející Hľadať Čas do člen určitý Artikel

mysql forgot password mysql zabudnuté heslo - -- xampp mysql password xampp MySQL heslo - -- mysql remove password mysql odstrániť heslo - -- forgot mysql password Pripomenúť heslo mysql - -- reset mysql password reset MySQL password - -- find mysql password nájsť MySQL heslo - -- mysql lost password mysql zabudnuté heslo - -- mysql change root password mysql root heslo zmeniť - -- xampp reset mysql password xampp mysql reset hesla - -- forgot password mysql zabudnuté heslo mysql - -- how to remove mysql root password ako odstrániť mysql root heslo - -- windows mysql password windows mysql heslo - -- how to find mysql password ako nájsť MySQL heslo - -- mysql root password reset mysql root hesla - -- recover mysql root password windows obnoviť windows mysql root heslo - -- remove mysql password odstrániť MySQL heslo - -- forget mysql password zabudnúť MySQL heslo - -- recover mysql password windows obnoviť MySQL heslo windows - -- forgot mysql root password windows Zabudol windows mysql root heslo - -- remove mysql root password odstrániť mysql root heslo - -- reset root password mysql resetovať heslo užívateľa root mysql - -- reset mysql server password reset MySQL server heslo - -- lost password xampp zabudnuté heslo xampp - -- lost password mysql zabudnuté heslo mysql - -- remove password mysql odstrániť heslo mysql - -- mysql recover password windows mysql obnoviť heslo windows - -- mysql server default password mysql server predvolené heslo - -- change the root password in windows Zmena root hesla vo windows - -- mysql lost password windows mysql zabudnuté heslo windows - -- default xampp mysql password Predvolené xampp MySQL heslo - -- default password mysql predvolené heslo mysql - -- default mysql password Predvolené MySQL heslo - -- how to recover mysql root password windows ako obnoviť windows mysql root heslo - -- how to remove mysql password ako odstrániť MySQL heslo - -- mysql-init.txt mysql-init.txt - -- mysql password remove mysql hesla odstrániť - -- mysql disable password mysql zakázať heslo - -- mysql forgot root password mysql zabudli heslo užívateľa root - -- remove root password mysql odstrániť heslo užívateľa root mysql - -- xampp reset password xampp reset hesla - -- mysql password Windows mysql hesla systému Windows - -- mysql remove password for root mysql odstrániť heslo pre užívateľa root - -- MySQL default password MySQL chyba heslo - -- mysql delete root password mysql root heslo zmazať - -- forget mysql root password zabudnúť mysql root heslo - -- reset xampp reset xampp - -- xampp password mysql xampp MySQL heslo - -- restore mysql root password obnoviť mysql root heslo - -- xammp reset mysql password xammp reset MySQL password - -- default mysql server password Predvolený server MySQL heslo - --