Change and Reset MySQL root Password Pārmaiņas un Reset MySQL root paroli
Other then the ways specified Citi pēc tam, kā noteikts here šeit 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: atiestatīt un mainīt root paroli MySQL datubāzes gadījumā, parole ir aizmirsta vai pazaudēta, sekojot norādēm izskaidrot detalizēti alternatīvā veidā pēc pēdējā daļa guide, ja nav papildu fails ir jārada:
- Login as root to the Windows or Unix-like (Unix, Linux or BSD) machine with the MySQL server. Login kā root uz Windows vai Unix tamlīdzīgi izstrādājumi (Unix, Linux vai BSD) mašīna ar MySQL serveri.
- Stop the MySQL server by using either of the following command: Apturēt MySQL serveri, izmantojot kādu no šādu komandu:
Linux: /etc/rc.d/init.d/mysql stop Linux: / etc / rc.d / init.d / mysql stop
FreeBSD: /usr/local/etc/rc.d/mysql-server.sh stop FreeBSD: / usr / local / etc / rc.d / mysql-server.sh stop - Open the mysql server startup script (ie mysql-server.sh – the file executed to start or stop MySQL server. Atvērt mysql servera palaišanas skriptu (piemēram, mysql-server.sh - fails izpilda sākt vai pārtraukt MySQL serveri.
- Add –skip-grant-tables to the end of the line that contains the mysqld_safe command as its parameter. Add-skip-dotāciju tabulas beigās līnijā, kas satur mysqld_safe komandu kā tās parametrs.
- Start MySQL server with the following command: Start MySQL serveri ar šādu komandu:
Linux: /etc/rc.d/init.d/mysql start Linux: / etc / rc.d / init.d / mysql sākums
FreeBSD: /usr/local/etc/rc.d/mysql-server.sh start FreeBSD: / usr / local / etc / rc.d / mysql-server.sh sākums - Alternatively, start the MySQL server directly and skip the editing with the following command: Alternatīvi, start MySQL servera tieši un izlaist rediģēšana ar šādu komandu:
mysqld_safe –skip-grant-tables & mysqld_safe-skip-dotāciju galdi &
Depending on your path environment, you may need to point to the correct directory where mysqld_safe is instead. Atkarībā no jūsu ceļa vidē, jums var būt nepieciešams, lai norādītu uz pareizo direktoriju, kur mysqld_safe ir vietā.
- Run the following commands to login as the mysql user and connect to mysql user/permission database: Palaist šādas komandas lai pieteiktos kā mysql lietotājs un pieslēgties mysql lietotājs / atļauju datu bāze:
# mysql -u root mysql # Mysql-u root mysql
- Run the update queries to change the MySQL password: Palaist update vaicājumus mainīt MySQL parole:
mysql> UPDATE user SET Password=PASSWORD('newrootpassword') WHERE User='root'; mysql> UPDATE lietotāja SET Password = PASSWORD ( 'newrootpassword') WHERE user = 'root';
mysql> FLUSH PRIVILEGES; mysql> FLUSH privilēģijas;Note: Replace newrootpassword with the new root password for MySQL server. Piezīme: Aizvietot newrootpassword ar jaunu root paroli MySQL serverim. Flush Privileges is needed to making the password change effect immediately. Flush privilēģijām ir nepieciešama, lai padarītu paroles maiņas spēkā nekavējoties.
- Exit mysql database client by typing exit. Iziet mysql datubāzes klients ierakstot exit.
- Stop MySQL server with commands listed at step 2. Apturēt MySQL serveri ar komandu uzskaitīti 2 soli.
- Open the mysql server startup script edit in step 3 again and remove the –skip-grant-tables parameter that has been added. Atvērt mysql servera startēšanas skriptu rediģēt 3 soli vēlreiz un noņemt-skip-dotāciju tabulas parametriem, kam ir pievienots.
- Start MySQL server by using command from step 5 or 6. Start MySQL serveri, izmantojot komandu no 5 ātrumi vai 6.
For Redhat Linux users, use the following instructions as the root user of Redhat Linux machine: Par Redhat Linux lietotājiem, izmanto šādas instrukcijas kā root lietotājam Redhat Linux mašīna:
- Stop MySQL process by using command: Pārtraukt MySQL process, izmantojot komandu:
# killall mysqld # Killall mysqld
- Start the MySQL server with following options: Start MySQL serveri ar šādām iespējām:
# /usr/libexec/mysqld -Sg –user=root & # / Usr / libexec / mysqld-SG-user = root &
- Start the MySQL client: Start MySQL client:
# mysql # Mysql
You should see the following message: Jums vajadzētu redzēt sekojošu vēstījumu:
Welcome to the MySQL monitor. Welcome to MySQL monitor. Commands end with ; or g. Commands end with; vai g.
Your MySQL connection id is 1 to server version: 3.xx.xx Jūsu MySQL Connection ID ir 1 pret servera versija: 3.xx.xxType 'help;' or 'h' for help. Tips 'palīdzību; "vai" h "palīdzību. Type 'c' to clear the buffer. Tips "C", lai skaidri buferšķīdumā.
mysql> mysql>
- Use mysql database: Izmantot mysql datubāzi:
mysql> USE mysql mysql> Lietot mysql
You should see the following message: Jums vajadzētu redzēt sekojošu vēstījumu:
Reading table information for completion of table and column names Lasījums tabulas informācija pabeigšanai tabulu un kolonnu nosaukumi
You can turn off this feature to get a quicker startup with -A Jūs varat izslēgt šo iespēju, lai iegūtu ātrāku sāknēšanas with -Database changed Database mainīts
- Then, update the password for the root user with the following command: Tad, atjauniniet paroli root lietotājam ar šādu komandu:
UPDATE user SET password=password(”newpassword”) WHERE user=”root”; UPDATE lietotāja SET Password = password ( "Newpassword") WHERE user = "root";
Replace newpassword with your desired password. Aizstāt Newpassword ar jūsu vēlamo paroli. You should see the following message: Jums vajadzētu redzēt sekojošu vēstījumu:
Query OK, 2 rows affected (0.03 sec) Query OK, 2 rows affected (0.03 sec)
Rows matched: 2 Changed: 2 Warnings: 0 Rows saskaņotās: 2 Changed: 2 Brīdinājumi: 0Rows affected may be different, but the Query OK should be there. Rindas ietekmēti, var būt dažādas, bet Query OK, būtu tur.
- Flush the database privileges to reload it in order to make the changes effective: Flush datubāzē privilēģijas pārlādēt to, lai izmaiņas efektīvi:
mysql> flush privileges; mysql> flush privilēģijas;
You should get the following result: Jums vajadzētu iegūt šādu rezultātu:
Query OK, 0 rows affected (0.02 sec) Query OK, 0 rows affected (0.02 sec)
- Exit the MySQL client by typing exit. Iziet MySQL klients, uzrakstot exit.
- Kill the MySQL server process by typing killall mysqld. Nogalināt MySQL servera process, ierakstot killall mysqld.
- Then start MySQL again: Tad sāk MySQL vēlreiz:
/etc/init.d/mysqld start / etc / init.d / mysqld sākums
IMPORTANT : The page is machine translated and provided "as is" without warranty. SVARĪGI: lapa mašīna iztulkot un pasniegts tàds, "kàds tas ir" bez garantijas. Machine translation may be difficult to understand. Mašīntulkošanas var būt grūti saprast. Please refer to Lūdzu, skatiet original English article oriģināls angļu rakstu whenever possible. kad vien iespējams.
Related Articles Saistītie raksti
- Reset the Root Password of MySQL Server Reset root parole MySQL Server
- Apple iPhone Root Password and Mobile User Password Apple iPhone root parole un Mobile Lietotājs Parole
- Reset and Change Windows NT/2000 Administrator or User Password with chntpw in Linux Reset un pārmaiņu Windows NT/2000 administrators vai Lietotājs Parole ar chntpw Linux
- Installing Web Server in FreeBSD 6.0 with Apache 2.2, MySQL 5.0 and PHP 5 – Part 3 Instalēšana Web Server 6.0 FreeBSD ar 2.2 Apache, MySQL 5.0 un PHP 5 - Part 3
- Change Oracle Database User Password Maina Oracle Database Lietotājs Parole
- Change or Set MySQL Long Query Time Value for log-slow-queries Mainīt vai Set MySQL Long Query Time Value for log-lēni vaicājumi
- Check and Optimize MySQL Database Automatically with Crontab/Cron Pārbaude un pilnveidošana MySQL Database automātiski ar Crontabula / Cron
- How to Reset WordPress Password to Recover Forgotten Secret Kā to Reset WordPress Parole Recover Aizmirsāt Secret
- Forgot Windows Administrator Password? Aizmirsāt Windows Administrator Password? Ways to Recover and Reset Password in Vista/XP/2003/2K/NT Veidi, lai atgūtu un Atjaunot paroli Vista/XP/2003/2K/NT
- Install phpBB 2 in Windows XP running on Apache 2, PHP 5 and MySQL 4 Install phpBB 2 in Windows XP darbojas 2 Apache, PHP 5 un MySQL 4










































September 20th, 2009 00:19 20 septembris 2009 00:19
I see it worked under Ubuntu for 'trail', but it did not work for me. Es redzu, ka strādāja pie Ubuntu "taka", bet tas nestrādāja mani.
On the contrary: even after following Rajesh's suggestion to use “–skip-grant-tables” instead of “-skip-grant-tables”, even after correcting the erroneous reference to “/etc/rc.d/init.d” for Linux (my Ubuntu has no such directory, it has only “/etc/init.d/”) I get strange error messages by the time I get to step 7. Par pretējo: pat pēc šādiem Rajesh ierosinājumu izmantot "-skip-dotāciju galdi", nevis "-skip-piešķirt-galdi", pat pēc tam, labojot kļūdainu norādi "/ etc / rc.d / init.d" par Linux (mana Ubuntu nav šāda direktorija, tas ir tikai "/ etc / init.d /") I get dīvaini kļūdas ziņojumus, kad es nokļūt soli 7.
It seems either one of two things goes wrong. Šķiet, ka vai nu vienu no divām lietām kas notiek nepareizi. Either 1) the server process starts, then soon dies or 2) if it finds the process running at all, it still gives me “ERROR 1045 (28000): Access denies for 'root'@'localhost' (using password: NO)” Nu 1) serveris process sākas, tad drīz nomirst, vai 2) ja tā konstatē, procesu darbojas visu, tā joprojām dod man "ERROR 1.045 (28.000): Access noliedz ar 'root' @ 'localhost' (izmantojot password: NO) "
What has my even more baffled is that I get this last message when trying to start and stop mysql! Kas ir manā vēl neizprotamu ir tas, ka man šo pēdējo ziņojumu, mēģinot iedarbināt un apturēt mysql!
Finally, the instructions to edit mysql are highly misleading: one cannot put “–skip-grant-tables” at the END of the line, since the line ends with redirection and '&'. Visbeidzot, instrukcijas rediģēt mysql ir ļoti maldinoši: viens nevar nodot "-skip-dotāciju tabulās" pēc beigas līniju, jo līnija beidzas ar redirection un '&'. The line now reads: Rindā ir šāds:
“/usr/bin/mysqld_safe –skip-grant-tables > /dev/null 2>&1 &” "/ Usr / bin / mysqld_safe-skip-dotāciju galdi> / dev / null 2> & 1 &"
I am running the very latest released Ubuntu, with all updates as of yesterday. Es esmu darbojas ļoti vēlāk atbrīvota Ubuntu, ar visiem, kas vakar atjauninājumiem.
August 8th, 2009 10:57 8 augusts 2009 10:57
[...] This article was written based on information from [...] Šis raksts tika rakstīts, pamatojoties uz informāciju no http://www.mydigitallife.info/2006/06/06/change-and-reset-mysql-root-password/ http://www.mydigitallife.info/2006/06/06/change-and-reset-mysql-root-password/ to illustrate changing the mysql password on [...] lai ilustrētu mainīt mysql paroli [...]
March 12th, 2009 17:35 12 marts 2009 17:35
@trail: Worked like a charm, thanks! @ taka: Strādājis kā šarmu, thanks!
September 23rd, 2008 17:22 23 septembris 2008 17:22
worked for me on ubuntu, in just one line: strādāja mani uz Ubuntu, tikai vienā line:
sudo dpkg-reconfigure mysql-server-5.0 sudo dpkg-pārstrukturēt mysql-server-5.0
July 3rd, 2008 05:46 3 jūlijs 2008 05:46
On ubuntu, command is mysqld_safe –-skip-grant-tables & Par Ubuntu, komanda ir mysqld_safe - skip-dotāciju galdi &
Extra dash is required so mysql can parse it correctly. Extra dash ir nepieciešama, lai mysql varētu izanalizēt to pareizi.
May 5th, 2008 16:52 5 maijs 2008 16:52
[...] judulnya), setelah googling cuma dapat cara untuk mereset dan mengganti password MySQL di UNIX-like di sini. [...] Judulnya) setelah googling Cuma dapat cara untuk mereset dan mengganti paroli MySQL di UNIX līdzīgu di sini. Wah, perlu sedikit modifikasi ni … Berikut cara2 yang saya lakukan: 1. Wah, perlu maz modifikasi ni ... Berikut cara2 yang saya lakukan: 1. Kill proses MySQL [...] Kill proses MySQL [...]
April 23rd, 2007 08:23 Aprīlis 23, 2007 08:23
[...] Change and Reset MySQL root Password » My Digital Life (tags: mysql administration) No Tags Gelesen: 2 / heute: 2 [...] [...] Pārmaiņas un Reset MySQL root paroli »My Digital Life (tags: mysql administrācija) Nr Tags Gelesen: 2 / heute: 2 [...]
December 19th, 2006 14:54 Decembris 19, 2006 14:54
[...] Re: Help me retrieve my password Try this link… Change and Reset MySQL root Password [...] Re: Help me ielādētu manu paroli Try this link ... pārmaiņu un Reset MySQL root paroli
July 9th, 2006 12:05 9 jūlijs 2006 12:05
I wanna reset my ZXDSL 831 ADSL Modemn Es gribu, lai atjaunotu manu ZXDSL 831 ADSL Modemn
Plz tell me the way how to reset it Plz tell me veids, kā, lai atjaunotu tā
I need to do that right now Man tas ir jādara tūlīt
Best Rgds Best rgds
dugger(vincitore) dugger (vincitore)
June 6th, 2006 18:18 6 jūnijs 2006 18:18
[...] 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 here): [...] [...] Vai arī uz jebkuras platformas, mysql klients var izmantot, lai uzstādītu jauno paroli, lai gan tas ir tik droši kā atgriezi paroli (detalizētiem norādījumiem šeit): [...]