Recover MySQL root Password

You can recover MySQL database server password with following five easy steps.

Step # 1: Stop the MySQL server process.

Step # 2: Start the MySQL (mysqld) server/daemon process with the –skip-grant-tables option so that it will not prompt for password.

Step # 3: Connect to mysql server as the root user.

Step # 4: Setup new mysql root account password i.e. reset mysql password.

Step # 5: Exit and restart the MySQL server.

Here are commands you need to type for each step (login as the root user):

Step # 1 : Stop mysql service

# /etc/init.d/mysql stop
Output:

Stopping MySQL database server: mysqld.

Step # 2: Start to MySQL server w/o password:

# mysqld_safe --skip-grant-tables &
Output:

[1] 5988
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[6025]: started

Step # 3: Connect to mysql server using mysql client:

# mysql -u root
Output:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

Step # 4: Setup new MySQL root user password

mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit

Step # 5: Stop MySQL Server:

# /etc/init.d/mysql stop
Output:

Stopping MySQL database server: mysqld
STOPPING server from pid file /var/run/mysqld/mysqld.pid
mysqld_safe[6186]: ended

[1]+  Done                    mysqld_safe --skip-grant-tables

Step # 6: Start MySQL server and test it

# /etc/init.d/mysql start
# mysql -u root -p


🐧 Please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
311 comments… add one
  • Sibaprasad Sahoo Jul 15, 2017 @ 9:13

    hiii , am using edureka for hadoop purpose in sql prompt i was forgott the password, i have already tried all the process u have mentioned in upper steps. But the prblm is that whenever i stop the sqld process and goes for start sqlserver without password its showing permission denied and if i tried the same process using sudo mode it will ask for sudo edureka password can u suggest me how should i recover my password.If u need then i will provide its screenshot also.

  • ANTMAN Jan 17, 2017 @ 15:12

    Somehow the password field changed to authentication_string.

    UPDATE mysql.user
        SET authentication_string = PASSWORD('MyNewPass'), password_expired = 'N'
        WHERE User = 'root' AND Host = 'localhost';
    
  • Josh Jan 13, 2016 @ 9:23

    It does work while the official guide of MYSQL doesn’t.
    Thanks for your sharing from 2016.

  • Philippe Jan 5, 2016 @ 8:51

    omg) another thank from 2016 for your post

  • Rahul D Dec 4, 2015 @ 18:44

    Hi,

    Is there any way to view the password of Mysql command line client.
    I dont want to change or reset the password because of the changing month password policy and I would be in a trouble.

  • wamo Nov 11, 2015 @ 8:11

    Thank you so much for this!

  • Jhon Sep 7, 2015 @ 17:57

    (mysqld_safe –skip-grant-tables &)this command is not working it getting stuck not getting any output.

    [root@desktopx ~]# /etc/init.d/mysqld stop
    Stopping mysqld: [ OK ]
    [root@desktopx ~]# mysqld_safe –skip-grant-tables &
    [1] 3650
    [root@desktopx ~]# 150908 02:55:32 mysqld_safe Logging to ‘/var/log/mysqld.log’.
    150908 02:55:32 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

  • Arun Puthal Apr 8, 2015 @ 12:01

    Thank You… It works….

  • Faust Mar 9, 2015 @ 22:04

    This page save my ass.

    But I logged to mysql as debian-sys-maint user, the password is located at /etc/mysql/debian.cnf then I followed the steps on this page.
    The debian-sys-maint user has full privileges.

  • Dan Jan 17, 2015 @ 3:12

    Thanks!

  • Clive Oct 25, 2014 @ 12:11

    Thank you so much for this helpful post, after struggling for TWO DAYS to reset my password its fixed!
    I can not thank you enough.

  • Hector Oct 2, 2014 @ 17:28

    Thank you

  • Duna Sep 11, 2014 @ 16:37

    Thank you, worked like a charm 🙂

  • Nobin Sep 11, 2014 @ 9:59

    Life saviour….
    As usual cyberciti.biz at its best. Thanks a lot.

  • Supun Sep 9, 2014 @ 14:12

    Where should I type those commands? # mysqld_safe –skip-grant-tables &
    (I’am a beginner)

  • Yegane mehr Jul 23, 2014 @ 13:39

    Hi,
    I’ve translated it into Persian:
    http://blog.jeyserver.com/recover-mysql-root-password/

  • Alexandre Jun 23, 2014 @ 15:44

    God bless you man! 😀

  • Swapna Kumar Jun 13, 2014 @ 5:42

    Worked Great…!!!! Thanks a ton…!!!

  • Brad Jun 11, 2014 @ 15:41

    Saved me. Thank you!

  • Tales G. Jun 6, 2014 @ 16:59

    Worked very well. Thanks.
    Used to reset the password on a Digital Ocean droplet.

  • Lucas Ribeiro Jun 5, 2014 @ 18:14

    Really really really really really THANK YOU.

  • papastatic Apr 8, 2014 @ 9:01

    just wanted to say a sincere thanks to you.

  • irimiaio Mar 1, 2014 @ 11:08

    Thanks! It works! 🙂

  • Jon Feb 26, 2014 @ 21:57

    thanks !!!!!!!!

  • Disel Feb 22, 2014 @ 1:15

    I used to be suggested this web site by means of my cousin. I am no longer sure whether this post is written by him as no one else understand such specific about my problem. You are amazing! Thank you!

  • William Feb 8, 2014 @ 16:15

    Excellent style and way to explain.
    Thank you.

  • Rahul dev Jan 23, 2014 @ 6:58

    After installing my sql,it ask to enter the password bt couldnt get that one.i tried “root”,”password” but couldnt open…can u give me one solution please….

  • Piotrek Jan 20, 2014 @ 21:18

    Even after so many years since this solution has been posted, it is still invaluable !
    Saved me a few headaches….. : – )

    Thanx heaps !

  • sandeep Nov 14, 2013 @ 8:50

    Thank you very much. The post was very useful in recovering my root password for mysql. Thanks a lot !

  • walter okenye Nov 13, 2013 @ 15:31

    wooow! neva been such happy before in the world of linux,…thanx geek.

  • Ilan Oct 30, 2013 @ 14:53

    Can you please tell me what is going on?
    It never finishes step 2

    ilan@ilan-main:~$ sudo /etc/init.d/mysql stop
    * Stopping MySQL database server mysqld [ OK ]
    ilan@ilan-main:~$ sudo mysqld_safe –skip-grant-tables &
    [3] 5595
    ilan@ilan-main:~$ 131030 16:44:40 mysqld_safe Can’t log to error log and syslog at the same time. Remove all –log-error configuration options for –syslog to take effect.
    131030 16:44:40 mysqld_safe Logging to ‘/var/log/mysql/error.log’.
    131030 16:44:40 mysqld_safe A mysqld process already exists

    I tried opening a second terminal with
    sudo mysql -u root
    but it told me that it wouldn’t open with no password. What is the story with the log files? Is this is what is stopping it?

    Thanks,
    Ilan

  • jpk Oct 4, 2013 @ 6:00

    Thanks for it..
    Worked like a charm 🙂

  • Aun Raza Sep 23, 2013 @ 10:49

    Thanks alot it saved alot of my time. this really works 🙂

  • anonymoous Sep 10, 2013 @ 6:26

    Thank you ….Saved time

  • anon Aug 20, 2013 @ 14:49

    Cheers – saved a network engineer talking to db admins!

  • Ahmed Samir Aug 13, 2013 @ 13:00

    Saved me a lot of time Thank you .

  • ketan Jul 26, 2013 @ 7:29

    Thanks..it works great 🙂

  • Chamara Jul 2, 2013 @ 17:22

    Thank you so much. This post was very useful

  • Andrew May 31, 2013 @ 1:05

    What about specifying an alternate port? I’m trying

    mysqld_safe –skip-grant-tables –port=3307

    and getting:

    130530 21:05:21 mysqld_safe Logging to ‘/var/log/mysqld-error.log’.
    130530 21:05:21 mysqld_safe A mysqld process already exists

    It doesn’t acknowledge the –port parameter ….

  • edram May 7, 2013 @ 21:44

    Genial…. (Y) Thanks!!!

  • Gayan Apr 12, 2013 @ 5:43

    Thanx alot,
    Supper tutorial….

  • Chandana Apr 10, 2013 @ 11:02

    Thank you for the information. Keep up the good work!

  • kutex09 Mar 4, 2013 @ 15:01

    Worked very well. Thanks!!
    I did it on both development and live server hosting critical University databases today running Suse Linux. Saved me a lot after many days.
    There were one or things I had to add *:

    (1) Stop the server: /etc/init.d/mysql stop (be sure to do it at off peak hours!)
    (2) Start the mysql daemon: # mysqld_safe –skip-grant-tables &
    (3)* While its running, open another terminal and login to mysql
    # mysql -u root (hit enter)
    (4) Now you are logged in.
    mysql>use mysql;
    mysql>update user set password=PASSWORD(“YOUR_NEW_PASS”) where User=’root’;
    you should see the output: Query ok etc.
    mysql>flush privileges;
    mysql>quit
    (5) stop the server: /etc/init.d/mysql stop
    (6) *Confirm that no mysql processes are still running (in my case they were and made the server fail to start). To check this: run this
    ps ax | grep mysql
    Now kill the process IDs of any mysql still running in the background using kill PID
    e.g. kill 4425. Do not use kill -9 as this may crash the database entirely!!
    Confirm no mysql process is still running: ps ax | grep mysql
    (7) Then start the server: /etc/init.d/mysql start
    (8) login with your new password: mysql -u root -p

    That worked for me on SLES10. hope it helps someone.

    Thanks.

  • genks Feb 22, 2013 @ 0:22

    it saved my time! thanks a lot

  • Allen Jan 13, 2013 @ 4:22

    Saved me a ton of time and frustration with the mysql root. Thanks a million.

  • John Dec 10, 2012 @ 7:59

    Advice does not work if Upstart is being used. Upstart will just keep respawning the process. You must first hide /etc/init/mysql.conf from Upstart.

  • Edward Nov 20, 2012 @ 16:45

    Thanks a ton. You saved hours of hit and trial.

  • en Nov 14, 2012 @ 12:10

    Thanks! Had to use mysqladmin shutdown since both the below commands did not work. On Ubuntu 12.04.

    eric@app-server:~$ sudo service mysql stop
    stop: Unknown instance:

    eric@app-server:~$ /etc/init.d/mysql stop
    Rather than invoking init scripts through /etc/init.d, use the service(8)
    utility, e.g. service mysql stop

  • Ryan Nov 5, 2012 @ 4:30

    Thank you. The script is clear and saved my day!

  • Keef Nov 2, 2012 @ 15:14

    Nice instructions – worked fro me on Windows – many thanks.

  • Mansoor Oct 17, 2012 @ 7:38

    Thanks worked like a Charm! keep doing the good work!

  • phe Oct 5, 2012 @ 1:48

    thanks bro, this work very easy 🙂

  • punit chitra Oct 4, 2012 @ 12:04

    nice explanation and recovered my root password. simple and easy steps

  • romin Sep 13, 2012 @ 11:23

    Thanks for share

  • tizzie Sep 6, 2012 @ 5:49

    Thanks!

  • sakar Sep 5, 2012 @ 6:43

    Thanks a ton. Saved me so much time.

  • Tushar Aug 28, 2012 @ 19:46

    setuser@setuser-desktop:~$ mysqld_safe –skip-grant-tables
    nohup: ignoring input and redirecting stderr to stdout
    Starting mysqld daemon with databases from /var/lib/mysql
    mysqld_safe[7459]: started
    STOPPING server from pid file /var/run/mysqld/mysqld.pid
    mysqld_safe[7469]: ended

    mysqld started in safe mode but suddenly it ended as above. Any idea ??

  • Maxi Aug 28, 2012 @ 11:45

    Thank you very much!!!!
    you helped me a lot!!!!

  • keshaV Aug 16, 2012 @ 12:33

    at last i did it… thanks a loads vivek :):)

  • tohid Aug 3, 2012 @ 19:07

    Thank you so much for the detailed steps. This really helped me to recover my database password.

  • Manisha Jul 25, 2012 @ 12:16

    Vivek, This works very well. Vivek rocks!!!

  • Edison roberto Jul 12, 2012 @ 16:54

    Thanks! This worked well! 2

  • John Jul 9, 2012 @ 13:33

    Thanks man, you saved my life 🙂

  • sukhbir Jun 20, 2012 @ 7:08

    Can anyone tell me where i have to write the above command ?

  • Sites em Porto Alegre Jun 12, 2012 @ 20:07

    Thank you so much for this!
    I was getting crazy already!

  • Sites em Porto Alegre Jun 12, 2012 @ 20:06

    Thanks so much for this man!
    I was banging my head against the wall

  • Manisha May 24, 2012 @ 4:38

    When I tried this for the first time, I got the following error saying,
    ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
    Then resolved that issue following the steps in http://ubuntuforums.org/showthread.php?t=804021
    Again for the second time, re-tried the steps in this blog. And it PERFECTLY WORKED.

    Thanks alot.

  • Helen Neely Apr 23, 2012 @ 12:03

    Thanks for this tip. I was struggling with my installation and this helped. I didn’t think it was possible to reset the default password.

    Thanks again.

  • killsometimes Apr 11, 2012 @ 12:34

    Thanks for your useful article. I have done it and it works perfectly.

  • koton Apr 9, 2012 @ 12:09

    thank you.

  • Phani Mar 21, 2012 @ 21:52

    I used this more than once so far!!. Thanks for helping out.

  • Eike Düvel Mar 19, 2012 @ 23:16

    Why is this tutorial not on the first place in the google results? This guy saved me!

  • Tia Daryatmo Mar 11, 2012 @ 9:42

    wow! when there’s no one around, this tutorial helps me a lot!!! thank you.. and big hugs from jakarta to you!!!!!

    @tdaryatmo

  • firdi Mar 8, 2012 @ 20:09

    thank you…thank you…thank you…thank you…thank you…

  • pouya Feb 25, 2012 @ 12:20

    really easy really helpful step by step guide. saved my ass. thank u thank u so muchhhhhhhhhh

  • supriya Feb 15, 2012 @ 5:51

    Thank you so much for the detailed steps. This really helped me to recover my database password…

  • Yuleisa Feb 8, 2012 @ 0:52

    – Quote – My daaabtse is about 1GB, so I set my innodb_buffer_pool_size to 2GB– End Quote –Is that your daaabtse memory size or your daaabtse file size? Thanks

  • Sam Feb 7, 2012 @ 11:43

    I think there is a mis-communication in your tiourtal…I copied and pasted these two lines:./bin/mysqladmin -u root password ‘**PASSWORD**’./bin/mysqladmin -u root -h **IP_ADDRESS** password ‘**PASSWORD**’and I got this error:Unknown MySQL server host ‘**IP_ADDRESS**’ (1)’Check that mysqld is running on **IP_ADDRESS** and that the port is 3306.You can check this by doing ‘telnet **IP_ADDRESS** 3306′What should I do?

  • Hiroshi Feb 7, 2012 @ 8:38

    Andrew,Swap out ‘**PASSWORD** for what ever psrawosd you want to use.**IP_ADDRESS** for your local machine IP ( EG 10.0.0.xx or 192.168.1.xx … )

  • RK Feb 1, 2012 @ 10:15

    Very easy and Straight forward

  • MiniVZ Dec 26, 2011 @ 0:58

    Thank you, I have reset my MySQL Password. Works on CentOS 6, though its mysqld instead of mysql for the start/stop of mysql.

  • Jaume Dec 21, 2011 @ 17:21

    Gràcies. feia temps que ho necessitava.

  • Francis Dec 15, 2011 @ 18:11

    Thanks for this.. Worked like a charm on CentOS 5.

  • Ahmed Salem Dec 6, 2011 @ 21:02

    thanks a lot . it’s really descriptive 🙂

  • Ege Dec 6, 2011 @ 0:37

    Couldn’t be neater, thank you!

  • Vivek Kumar Nov 22, 2011 @ 9:57

    Thanks! This worked well!

  • Keimpe de Jong Nov 22, 2011 @ 7:15

    I encountered the stunning situation where there was no root user

    replace

    update user set password=PASSWORD(“NEW-ROOT-PASSWORD”) where User=’root’;

    with

    insert into user(Host, User, Password, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv, References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv, Create_view_priv, Show_view_priv, Create_routine_priv, Alter_routine_priv, Create_user_priv, ssl_type, ssl_cipher, x509_issuer, x509_subject, max_questions, max_updates, max_connections, max_user_connections) values ('localhost', 'root', PASSWORD("my_password"), 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y',   'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y',    'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', '', '', '', '', '0', '0', '0', '0');
    
    • alan Apr 14, 2012 @ 3:56

      Same here — no root user, 0 rows affected on the update… couldn’t figure it out. your insert worked fine for me, then ran the update to set the password, then flushed privs, then restarted mysql…. done and working now… thanks!

  • Peter Fisher Nov 19, 2011 @ 13:47

    Awesome Awesome Awesome. Very helpful indeed

  • Ian Nov 6, 2011 @ 13:22

    Using – service mysqld stop/start worked for me.

  • anonymouse Oct 27, 2011 @ 8:47

    it was really helpful..thanks

  • Robbo Oct 24, 2011 @ 8:50

    It really works! Thanks a lot!

  • Lnux7802 Oct 7, 2011 @ 5:06

    yep,this site having good kb

  • ardent Sep 6, 2011 @ 7:15

    Thanks guys, this greatly works.

  • Cuong Aug 28, 2011 @ 14:37

    Thanks! very useful.

  • Erez Aug 19, 2011 @ 15:54

    Thanks A bunch! Simple to follow and woks!

  • fti Jul 30, 2011 @ 22:31

    thanks a lot, clean information

  • San Jul 27, 2011 @ 17:49

    Really helpful information, saved me a lot of time.

  • JC Jul 7, 2011 @ 12:20

    Thanks!
    You save me!!!

  • boe var Jun 12, 2011 @ 8:43

    Thanks a million! That step 2 is a life saver!

  • praveen May 16, 2011 @ 5:02

    Hi,

    This really worked for newbie like me. Thank you.

    Praveen

  • Charlie May 14, 2011 @ 2:02

    mysql.user table may also need to be updated to new password format.
    Run mysql_upgrade (or, earlier, mysql_fix_privilege_tables) to do this.

  • Ricardo May 10, 2011 @ 20:31

    Thanks Vivek!
    u just saved my day!! 😀

    thumbs up!

  • Faiyaz May 3, 2011 @ 12:56

    Thankyou so much.. works cheer…………………….

  • Me myself and Irene May 3, 2011 @ 12:30

    Thanks a million 🙂

  • Shiv May 3, 2011 @ 3:53

    thanx Vivek… Dude you rock!!!.. Please prove some more link for mysql..

  • Vanja Apr 10, 2011 @ 21:38

    Awesome stuff! Saved me a re-installation! Thanks dude!

  • rhyeal Apr 8, 2011 @ 17:44

    Works like a charm. Thanks a ton!

  • daminda Apr 7, 2011 @ 17:04

    thank you very much.. very clear

  • blarehead Mar 28, 2011 @ 10:52

    thanks!!!. it works great!

  • Debu Mar 24, 2011 @ 17:25

    Thanks. It really worked.

  • Thierry Mar 23, 2011 @ 15:07

    you save my ass 😀 , thankssss

    From Argentina

    Thierry

  • Mats Mar 22, 2011 @ 2:48

    I don’t have the MySQL root password as I had help setting it up, and the he never gave me the root password I now I can’t find the idiot (for Months).

    I tried the tutorial above, but I can’t get in. The error I get is “ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)”

    Where am I supposed to insert the new username and password?

    Thanks!
    Mats

    • Remigio Hernández Jun 22, 2011 @ 1:13

      Thanks a lot VIVEk , it really works.

    • Remigio Hernández Jun 22, 2011 @ 1:19

      Mats en the step 4:

      Step # 4: Setup new MySQL root user password

      mysql> use mysql;
      mysql> update user set password=PASSWORD(“NEW-ROOT-PASSWORD”) where User=’root’;
      mysql> flush privileges;
      mysql> quit

      Remigio

  • david familian Mar 21, 2011 @ 20:49

    hi
    10.6 OS 64bit
    i couldn’t get
    bash-3.2# /etc/init.d/mysql start
    bash: /etc/init.d/mysql: No such file or directory

    on a mac the path is /usr/local/mysql/support-files/mysql.server start

    so i used this /usr/local/mysql/support-files/mysql.server start –skip-grant-tables ( got this from here)

    and followed your instructions

    any idea why mysqld doesn’t work to start or stop server

    i get this
    bash-3.2# mysqld stop
    110321 13:33:12 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql-5.5.10-osx10.6-x86_64/data/ is case insensitive
    110321 13:33:12 [ERROR] Fatal error: Please read “Security” section of the manual to find out how to run mysqld as root!

    110321 13:33:12 [ERROR] Aborting

    110321 13:33:12 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

  • man910 Mar 16, 2011 @ 14:48

    Thanks!

  • Khalil Mar 15, 2011 @ 3:00

    Thanks a lot! Was very helpful to me too.
    All the Best!

  • Ahamed Mustafa Feb 19, 2011 @ 12:09

    It worked like charm !! Excellent !! Thanks a lot…

  • markos Feb 14, 2011 @ 13:11

    Brilliant!!! Thanks a lot mate

  • pdwalker Feb 10, 2011 @ 3:29

    Fantastic!

    Thanks!

  • Jeff Jan 28, 2011 @ 17:58

    Thank you! Thank you! Thank you!

  • Robert Jan 27, 2011 @ 17:44

    Let me echo what everyone else is saying…. THANK YOU!!!

  • Vipin Jan 6, 2011 @ 13:57

    Thanks. 🙂

  • _Jan Nov 13, 2010 @ 18:06

    Thanks a lot! That did it!

  • Prabhu Oct 22, 2010 @ 7:47

    YOU THE MAN

  • nicko Oct 20, 2010 @ 14:21

    eternal gratitude for this one! 🙂

  • arora Oct 7, 2010 @ 10:21

    thank you so much brother for posting this….great great help.

  • ChooseN Oct 6, 2010 @ 10:41

    THX A LOT

  • العاب Sep 17, 2010 @ 21:21

    thank you
    anthoer way to do this
    perl /scripts/mysqlpasswd root newpass

    thank you

  • Sami Sep 6, 2010 @ 4:00

    root@server:~# mysql stop
    ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)

  • Sriram Aug 11, 2010 @ 17:16

    Thanks so much!

    • Theo Sep 5, 2010 @ 23:58

      !!!! FULL — BUT QUICK — REINSTALL !!!!

      To the ones still suffering from this persistent — and annoying — issue, the best solution I’ve come across so far is to remove & re-install mysql (using yum, apt-get, dpkg, or whatever you like the most).

      Now, the tricky step that most of the online tutorials forget to mention is that after removing mysql and — of course — BEFORE reinstalling it, you MUST remove the original db’s directory, usually under /var/lib/mysql/

      The latter is specially true for CentOS users.

      Here´s a wrap-up of the whole process:

      1) Make sure mysql is not running:
      [root@mybox ~] # /etc/init.d/mysqld stop

      2) Remove mysql:
      [root@mybox ~] # yum remove mysql-server
      [root@mybox ~] # yum remove mysql

      2) Remove the offending db:
      [root@mybox ~] # rm -rf /var/lib/mysql

      3) Re-install mysql:
      [root@mybox ~] # yum install mysql-server
      [root@mybox ~] # yum install mysql
      [root@mybox ~] # yum install mysql-devel

      4) Re-install php’s access to mysql:
      [root@mybox ~] # yum install php-mysql

      5) Start your newly installed db engine:
      [root@mybox ~] # /etc/init.d/mysqld start

      Now you can log in without using a password.

      6) Set a new password for root:
      [root@mybox ~] # mysql
      mysql> USE mysql;
      mysql> UPDATE user SET Password=PASSWORD(‘new-password’) WHERE user=’root’;
      mysql> FLUSH PRIVILEGES;
      mysql> EXIT

      I hope this solution saves you some headaches. It took me several hours to find out what was causing the problem.

      Cheers to all.
      Theo

  • nikkie Aug 3, 2010 @ 12:04

    i resolved it…..:D

  • nikkie Aug 3, 2010 @ 11:16

    actually i used wrong command….
    update mysql.user set password=”root” where user=”root” instead of
    update mysql.user set password=password(“root”) where user=”root”
    plz temme how to recover my password…thnx in advance

  • nikkie Aug 3, 2010 @ 11:10

    how can i recover my mysql password from cmd shell(windows environment)…

  • febndy Jul 27, 2010 @ 2:37

    where should I put the codes? can anyone teach me from the beginning? I use Win 7 64 bit.

  • Valenz Jul 24, 2010 @ 0:06

    GREAT GREAT GREAT!!!

  • InigoKintana Jul 16, 2010 @ 7:18

    Many Thanks.

    The procedure works great!!!

  • Vincent Jun 27, 2010 @ 11:40

    Thank you, thank you 🙂
    Sweet and nicely written tut.

  • Shraddha Kulkarni Jun 25, 2010 @ 6:37

    Hello Vivek,

    Thanks a Lot!!!
    Excellent article. Saved my many applications.
    Thanks once again!

  • tarun Jun 23, 2010 @ 10:43

    thankz a lot! save my pc box

  • Engel Jun 21, 2010 @ 13:14

    Thanks a lot!!!! saved me from fires of hell!!! lol

  • Gabriel Calusaru Jun 11, 2010 @ 11:20

    It doesn’t work. Password doesn’t change.

  • Atlanta Web Design Jun 10, 2010 @ 17:09

    Thank you for this information. Will the same steps work on a Windows box from the cmd prompt?

  • Humberto May 31, 2010 @ 17:49

    Great article!!! Thanks!!!

  • valen May 25, 2010 @ 14:13

    thanks for your HELP!!!!

  • Aitor May 21, 2010 @ 16:50

    Thank you! It also worked for me!

  • Dave May 19, 2010 @ 17:53

    Thanks it worked perfectly!

  • Garima May 19, 2010 @ 5:06

    Nice. Works very well!

  • Anonymous May 16, 2010 @ 20:44

    Excellent tutorial!
    This worked like a charm.

    congrats.

  • Ângelo May 12, 2010 @ 21:03

    Hi
    In the first command the prompt returns a messagem saying : ERROR 1045 (2800) Access denied for user root@localhost (Using password NO)

    Even after i have looged in as root in the linux system (sudo su root)

    Any tip ?

  • Caliventura May 1, 2010 @ 19:38

    I tried many times… Do not work for me…
    I Can’t change the password and I can’t remember the previous one.
    Maybe I doing some mistake with the line:

    update user set password=PASSWORD(“MyPassword”) where User=’root’;
    when I run: mysql -u root -p

    I put MyPassword…. And I get this error:

    ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)

    Does anybody knows what I doing wrong?

  • EB Apr 29, 2010 @ 1:19

    Thanks, I have spent three days trying to get MySQL functioning. It seemed that the password was lost, but after running the password still works.

  • Nosferatu Apr 22, 2010 @ 3:30

    Thnks if there were a puntuaction u’ll get a 10

  • ashenafis Apr 13, 2010 @ 8:02

    10 Q, it worked perfectly.

  • ubuntupunk Mar 31, 2010 @ 10:30

    It just hangs

    100331 12:28:26 mysqld_safe Logging to syslog.
    100331 12:28:26 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

  • Thomas R Adams Mar 23, 2010 @ 17:28

    I hope this works

  • Omar Mar 22, 2010 @ 6:09

    Great, thanks.

  • pedro Mar 19, 2010 @ 18:23

    Thanks dude. Saved me some problems 🙂

    Btw, like was said previously, the commands will work in Windows as well.

  • gary Mar 17, 2010 @ 22:01

    Awesome tip, tks, it was concise while providing enough information to be effective.
    Tks.

  • neil Mar 10, 2010 @ 6:04

    the most explicitly perfect tutorial yet. Saved My Ass Too

  • Bala Subramanian Mar 3, 2010 @ 5:18

    Thanks a lot man! Your post saved me rite on time!

  • MK Feb 18, 2010 @ 13:25

    Thanks a lot!

    saved my a#$

  • neilh Feb 15, 2010 @ 22:04

    That should of course have been MySql 5.1.36

  • neilh Feb 15, 2010 @ 22:02

    Am still trying to find a way to SET the root password. WAMP mysql 3.1.16. Win Vista 32 – currently no password required.

    Nothing on the ‘MySQL Change root Password’ thread works.

  • Heliogabal Feb 2, 2010 @ 0:28

    thank You so much – this was just what I needed.

  • Roque Jan 22, 2010 @ 19:10

    Thank’s a lot ..!
    Very simple way

  • Jayaprakash Jan 9, 2010 @ 1:10

    This was absolutely what they say, hitting the nail on the head. I was getting the error message and was hitting my hed on the wall when this gentleman came along and it worked like smooth butter.
    Thanx man , you rock

  • danidiaz Jan 5, 2010 @ 16:33

    Excellent tutorial!!

    Thank you very much!

  • Olle Dec 10, 2009 @ 13:12

    Yep, thanks!

  • Vipul Dec 9, 2009 @ 12:01

    Thanks to help me but I have not root user in user table of mysql database.
    Can you please tell me why such kind of things happened?

  • vibhav Dec 1, 2009 @ 12:11

    awsem…..brilliant….
    thanx a lot…..

  • Paul Mwiu Nov 26, 2009 @ 10:07

    Thanks for the above information. It has really helped alot.
    Cheers!!

  • Girish Nov 24, 2009 @ 5:16

    yess…… its working………Thanks a lot………

  • irelock Nov 19, 2009 @ 16:43

    MY a$$ was saved. Id almost thank you in person. Thanks a million and 1.

  • prajw2 Nov 15, 2009 @ 15:17

    it works!!!!!!!!!!!!!!!!!!!!!!!!!!!!!thankz a lot

  • Samir Dhok Nov 15, 2009 @ 14:37

    This works perfect.
    Thanks

  • thank Nov 13, 2009 @ 19:07

    helped me with my problem too.

    googled around but your solution was the leanest

  • niraj tiwari Oct 28, 2009 @ 2:42

    i miss my user and password

  • niraj tiwari Oct 28, 2009 @ 2:40

    i created my joomla with it set up and creeat user root and no password now my user and password is not working

  • Tuvshuu Oct 26, 2009 @ 14:36

    Hi guys. This help looks soo helpfull but i dont know how to use it. i really need to reset my password. but i dont know how to Start the MySQL (mysqld) server/daemon process with the –skip-grant-tables option. I went to mysqlbinmysqld but i cant type or do anything! can someone help me how to do those steps?

  • Alejandro Oct 15, 2009 @ 3:10

    Thaaaaaanks!!! finally could set my password with your help, was trying for days.. !!!

  • 🐧 nixCraft Oct 2, 2009 @ 9:30

    @ Shekhar, try the following url:

    http://www.cyberciti.biz/faq/mysql-user-creation/

  • Shekhar Charodiya Oct 2, 2009 @ 7:33

    Thanks Buddy U make my day

    Thanks again

    can u guide me how i make user in mysql and give them right to use

    If u have solution Guide me

  • Alfonso Sep 30, 2009 @ 21:56

    Hey… Thanks

    this works perfect..

    Funciona perfectamente…

  • eric lee Sep 28, 2009 @ 22:42

    Cool man !! you’re cool!

  • Amy Sep 18, 2009 @ 19:41

    How do i log in as root user if I do not know the password? Also, when I use the # /etc/init.d/mysql stop, it tells me that ‘#’ is not recognized as an internal or external command. I am not very knowledgeable about these things. I am on a windows system and I don’t know the root password. Please help. Thanks.

  • Ashish kumar Sep 17, 2009 @ 6:21

    thanx
    this is gr8 job
    so that i recover my mysql password

  • Carl Sep 17, 2009 @ 3:17

    Thanks. Very clear and well written, extremely helpful.

  • Michael Irwin Sep 13, 2009 @ 20:21

    Definitely the most valuable tip of the year so far! Well written, clearly written.

    Thank you very much!

    Mike I.

  • gajula vinod kumar Sep 10, 2009 @ 10:23

    Great job
    Without this i had reinstall and configure my bugzilla server
    Thanks a lot

  • newbie Sep 6, 2009 @ 5:59

    Awesome, I have been playing using MySQL on and off for almost 2years to understand it from a higher level and still getting use to it! This is the best straight forward instructions I’ve seen….and trust me I’ve looked at heaps 🙂

    So from a newbie, THANKS for taking the time!
    John B.

  • atrin Aug 30, 2009 @ 8:34

    hi , at first i want to thank you for your post its very useful for me
    actually i do all of above but when i want to access mysql with root (#mysql -u root -p)
    it said that ” ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES) ”

    could you please help me about this

  • LowKey Aug 20, 2009 @ 6:16

    Nice! Very helpful , Thanks!

  • Jhon Aug 16, 2009 @ 21:48

    i search for a couple hours Thank you

  • vorbis Aug 13, 2009 @ 16:20

    Thanks! Worked perfectly!

  • frick Aug 12, 2009 @ 2:17

    The new MYSQL has different table name for user. See http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html for details.

  • Martin Aug 6, 2009 @ 11:45

    i want to recover my password in windows.what should i do

  • Senthil Kumar Jul 30, 2009 @ 18:00

    I have tried your solution 5 times. But not working :((.
    [root@u15345903 /]# /etc/init.d/mysqld stop
    Stopping MySQL: [ OK ]
    [root@u15345903 /]# mysqld_safe –skip-grant-table &
    [1] 2278
    [root@u15345903 /]# Starting mysqld daemon with databases from /var/lib/mysql
    mysql
    Welcome to the MySQL monitor. Commands end with ; or g.
    Your MySQL connection id is 1
    Server version: 5.0.83 Source distribution

    Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the current input statement.

    mysql> use mysql;
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A

    Database changed
    mysql> update user set password=’blocialdb123′ where user =’root’;
    Query OK, 0 rows affected (0.00 sec)
    Rows matched: 0 Changed: 0 Warnings: 0

    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)

    mysql> quit;
    Bye
    [root@u15345903 /]# /etc/init.d/mysqld stop
    STOPPING server from pid file /var/run/mysqld/mysqld.pid
    090730 13:58:21 mysqld ended

    Stopping MySQL: [ OK ]
    [1]+ Done mysqld_safe –skip-grant-table
    [root@u15345903 /]# /etc/init.d/mysqld start
    Starting MySQL: [ OK ]
    [root@u15345903 /]# mysql -u root -p
    Enter password:
    ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
    [root@u15345903 /]#

  • dman3d Jul 23, 2009 @ 1:04

    Thanks a lot pal,
    your method rocks, save me a lot of time.

  • Mikheil Kalandadze Jul 17, 2009 @ 15:52

    THANK YOU.

    Help is easy and usable 😉 GREAT

  • zabi Jul 2, 2009 @ 18:50

    hi i want to know that how to remove or recover password which is on file when we open it in mysql it is asking for password how to remove them plz any one tell

  • ChrisW Jun 3, 2009 @ 10:51

    if you are using windows, you will still have the problem if you are using phpMyAdmin, open the config.inc.php, should be in your windows directory, change the password in there.

  • Jorge Calás May 26, 2009 @ 14:39

    Thanks!!!! It was really easy and worked like charm.

    Server version: 5.0.51a-24 (Debian)

  • Stuart May 26, 2009 @ 2:42

    This didn’t work for me. I now get the following when trying to log in: (I’m logged in as root):

    ctru2:~ # mysql -u root -p
    Enter password:
    ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

    What does this mean, and how do I get around it?

  • Rafael May 20, 2009 @ 22:18

    Tutoriais como esse deveriam ficar na wikipedia dos tutoriais!

    Abraço,

  • the_guv May 17, 2009 @ 8:50

    you are a ruddy hero.

    thank you.

  • Darrell May 12, 2009 @ 14:27

    THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU.

    Most sincerely,
    Darrell Goodman
    Toronto, Canada

  • newbie May 12, 2009 @ 14:05

    Thanks!

    It works gr8!

  • Michael Watson Apr 27, 2009 @ 5:21

    This worked really well. Thank you 🙂

  • carolija.eu Apr 24, 2009 @ 1:37

    Nice, thanks !

  • Timmy Apr 21, 2009 @ 16:12

    Thank You..

  • dawg Apr 11, 2009 @ 8:10

    omg, dude, you’re a genious….

  • ofir Mar 20, 2009 @ 14:59

    You saved me a lot of frustration, Thanks

  • Levon Mar 11, 2009 @ 22:55

    Thank you very much, I’ve waisted more than 2 hours trying to recover MySql password.
    Thanks again 🙂

  • Bais Mar 10, 2009 @ 9:05

    Very good, on ubuntu 9.04 mysqld 5.1 come installed with a mysterous password, I reseted it with this procedure and It works fine, thank you.

  • megan Feb 24, 2009 @ 5:06

    So Simple, yet so valuable. THANKS!

  • Jhon F. Ortiz O. Feb 20, 2009 @ 16:33

    Hi!
    Wonderful guide. Congratulations!
    Bye!

  • Skyline Feb 19, 2009 @ 14:11

    skip-grant-tables…. NICE!

  • Stephen Robinson Feb 17, 2009 @ 16:23

    thanx, wasted 2 hours googling and this method works,
    Stephen 🙂

  • ThouArtMyGod Jan 8, 2009 @ 18:51

    Thanks ever so much

  • More Jan 5, 2009 @ 17:32

    amazing… thanks a lot!!

  • Tim Dec 21, 2008 @ 5:13

    /etc/init.d/mysql stop
    * Stopping MySQL database server mysqld [fail]

    You ware going to need to fill in the gaps. If it fails then…….

  • Didrik Nordström Dec 18, 2008 @ 18:05

    Thank you! Saved my ass too.

  • Mike Runs Nov 24, 2008 @ 20:44

    Excellent!

    Buy that person a beer! Or other meaningful beverage of choice.

    Thanks!!

  • Richard J. Thomma Nov 24, 2008 @ 12:53

    It works — the very only one by far — Kubuntu 8.10
    Description is crisp concise and foolproof

    Thank You very much

    I wish I knew howto tell google

  • akzidenz Sep 26, 2008 @ 19:02

    Thanks a lot!
    Its much more elegant than the solution in the official mysql reference.

  • me Sep 24, 2008 @ 6:25

    Thank you , this is very helpful, as some one said it was the one excellent solution worked for me.

    my day is better

  • Matt Sep 2, 2008 @ 23:19

    Thank you very much. Windows users, you can do all of those commands from the command prompt, make sure you run it in admin mode, and change directory to where the mysql files are located, so when you run those commands it works. 🙂

  • Mohammad Aug 25, 2008 @ 15:10

    Thank you. I’ve been trying using Toad and Password recovery tools but to no avail. This got it done!

  • Steffen Aug 16, 2008 @ 10:07

    Thank you very much! Saved some hours of reinstalling mysql.

  • NetWebLogic Aug 15, 2008 @ 11:10

    Bookmarked for future reference! Thanks for the very straightforward explanation, can’t think of a better way to do it!

  • kailash Aug 4, 2008 @ 22:51

    Thanks a ton. I was stuck since a very long time. Could not find anywhere but here it was very clear.
    Thanks very much!

  • jim Aug 4, 2008 @ 16:48

    thanks this worked perfectly!!

  • Fatiha Jul 31, 2008 @ 12:37

    Thank you, it works now.

  • Robin86 Jul 23, 2008 @ 16:13

    great! good job 🙂
    this is really worth printable…

  • Paolo Jul 21, 2008 @ 11:52

    Fantastic! thanks a lot!

  • Wesley Chapel Homes for Rent Jul 11, 2008 @ 17:36

    The gift that keeps on giving, 2 years and counting, this helped me out big time… Thanks!

  • Ko Jul 3, 2008 @ 9:08

    THANKS!!!

    Useful and to the point!

    Ko.

  • Ochieng, Edmund Jun 27, 2008 @ 13:31

    After staying idle most of the day since i messed up the database, this is the best thing that happened on this day

  • uberdog Jun 25, 2008 @ 17:22

    BIG TNX!!!

  • FAISAL SAEED Jun 24, 2008 @ 9:53

    Good work. Thanks a alot!

    Faisal

  • sixhome Jun 15, 2008 @ 14:09

    Thanks! Many thanks!

  • Feodor Jun 12, 2008 @ 10:21

    thanks for this clear tutorial

  • dario Jun 10, 2008 @ 18:31

    thank you very very much!

  • Emmi May 20, 2008 @ 23:58

    Gleb, you need to use the unix shell as root to kill the mysql server process directly, then you can follow the mysql start without privileges command and get back in that way.

    If you don’t know how to get a process list and send it a signal, you should read up just a little bit on that.

    man ps
    man kill

    But something like:
    ps aux | grep mysql
    kill -TERM [processnumber# from command above]

    (yes there is a one step command, but I personally ashew wildcards in my kill commands)

  • Jens May 17, 2008 @ 10:50

    Thanks alot!! Also saved me some hours 🙂

  • Marty Wolf May 16, 2008 @ 18:07

    I tried all others, which failed!!!! This one works!!!! Thank you for making the instructions so simple to follow for us NON-LINUX Gurus. Much Thanks!

  • nisha May 13, 2008 @ 7:59

    Hi again,

    The problem I mentioned above, well, I tested it,and it works….thank you for the perfect guide 😉
    This is the i-can’t-remember-number-of-times that one of your articles has helped me… so, thanks for that too!

  • nisha May 12, 2008 @ 6:45

    Hi,

    Can I remove an existing password following you guide, except that i leave this portion:

    mysql> update user set password=PASSWORD(“NEW-ROOT-PASSWORD”) where User=’root’;

    as this :

    mysql> update user set password=PASSWORD(“”) where User=’root’;

    Would this work? I need to remove the password for a bit, for testing purposes…and then set the password again….any help/advise is much appreciated…

    -nisha-

  • gleb May 11, 2008 @ 13:10

    I’ve done everything exactly as it says , but still canot connect with my mysql server. I allways have this error: ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
    Even when i do NOT use a password , it just not working! i tryed to reintall mysql through synaptic , but still the same shit… No difference. Can enyone give an advise?

  • Mark May 9, 2008 @ 15:44

    I think I read this same article the last time my root acct got locked out. Thanks for hosting this page.

  • Victor Apr 22, 2008 @ 13:10

    I am using a windows op, how do I recover the password under Windows

  • Nilesh Mar 20, 2008 @ 12:03

    gr8 one! thanks.

  • richard scrivener Mar 12, 2008 @ 4:38

    You saved my ass!!! I can’t thank you enough!

  • Janus Mar 9, 2008 @ 9:46

    Thank you.
    God bless.

  • Tony Feb 12, 2008 @ 12:02

    another relieved joomla user here as Im now back in charge of mysql thanks a lot!

  • grateful Feb 12, 2008 @ 11:21

    Vivek,

    does this affect the dbases / the rest of the users in any harmful way?

  • john Feb 6, 2008 @ 17:30

    great, works exactly as shown. give the man a cigar!

  • Charles Feb 5, 2008 @ 6:47

    I love you all. This is the only solution that worked not even de.mysql’s solution worked…

  • Amir Jan 29, 2008 @ 8:16

    Thank you very much

  • Dave Brixius Nov 30, 2007 @ 2:51

    Greetings. Thank you so much. We are just getting our server up and running and working through some mysql issues. You saved me a lot of time and headaches. Dave

  • Sanford Nov 30, 2007 @ 1:49

    Many thanks, this saved me a lot of time.

  • SPS Oct 14, 2007 @ 15:09

    Yeah.. it is workin very well.. it saved me from formatting my Server… college 1……. :)..s o it works………..

  • Sam Oct 3, 2007 @ 10:26

    Dude, you rock my world. shotalot

  • alex Sep 27, 2007 @ 15:03

    THANK YOU!!!!!!!!!!!! THANK YOU!!!!!!!!!!!

  • murdock Sep 5, 2007 @ 3:05

    Thanks for the help. This was just what I was looking for. I have no idea how I blew away my password, but at least this helped me get back in.

    Thanks!
    Murdock

  • 🐧 nixCraft Aug 30, 2007 @ 18:10

    Open X terminal and at shell prompt use command:
    mysql -u root -p

    You should able to see an error message.

  • Meef Aug 30, 2007 @ 17:44

    Um… I’ve been trying to actually change the password for about 3 days now, and I tried this tutorial… No errors, but when I start the MySQL client and type in my password it just beeps and goes away 🙁 Is there any other way?

  • amin Aug 17, 2007 @ 8:15

    I got the following error

    ERROR! MySQL PID file could not be found!

    do have any solution

  • Gerard Jul 31, 2007 @ 12:15

    Coolness!!! This site is really the best! I also got a ftpbackup script from here! the best how to’s, I wish you the best and I hope that you could add more!!!

  • Gerard Jul 31, 2007 @ 12:10

    Coolness!!! thanks for this post! already bookmarked!!!hehehe..

  • Valentin Jul 23, 2007 @ 22:34

    Great tutorial.. it just worked fine

  • Linda Botes Jul 5, 2007 @ 7:51

    Thanks! I’ve been looking at numerous other solutions and none of them worked. This one worked, no hassles.

  • DngloZ May 12, 2007 @ 16:00

    thanks for this great post

  • Andrew May 10, 2007 @ 14:16

    Brilliant guide – lifesaver!

  • asia Mar 8, 2007 @ 7:11

    i want free download of Recover MySQL root password

  • Timothy matara Jan 12, 2007 @ 6:28

    This is great help, thanks for this posting!

  • Jm Dec 4, 2006 @ 0:54
  • Anonymous Oct 20, 2006 @ 16:15

    Hi,

    When I try stop mysql on my server, I receive a error 1045. Access denied for user: ‘root@localhost’ (Using password: NO)

    Thanks

  • 🐧 nixCraft May 20, 2006 @ 2:58

    Nice 🙂

  • Anonymous May 20, 2006 @ 2:33

    On most *nix systems as root (or with sudo) you can also do:

    cat /root/.mysql_history|more

    Which is very informative.

    • John Aug 17, 2011 @ 3:05

      -Much easier! thanks!

  • Charles May 19, 2006 @ 8:34

    thank you! i forgot my password and was afraid I had to reinstall mysql!. you saved me. props to you and msn search!

  • Anonymous May 4, 2006 @ 10:11

    Thanks a lot!
    I’ve been googling for 2 hours and your solution was the only one that worked!

    • Anonymous May 17, 2012 @ 2:46

      Serioiusly?

      • random_guy Apr 10, 2013 @ 18:30

        oh my god…. you forced me to comment because your asking “seriously?” to a comment made 6 years earliers LMAOOOOO

        • TimeTraveller Dec 26, 2013 @ 18:22

          And you replied 1 year later

          • ASAP Apr 7, 2014 @ 18:41

            Here I’m replying another year later.

            • Haha May 19, 2014 @ 12:13

              And here I am reading this and replying lol……..

              • Sweety Nov 5, 2014 @ 4:48

                Me too 🙂

                • sri krishna Jan 9, 2015 @ 12:11

                  Love u Sweety 🙂

                  • Dmitriy Aug 4, 2016 @ 3:33

                    Hello from Russia after 10 years from originaly comment!

                    • Carl Sep 2, 2016 @ 15:51

                      Greetings from Venezuela.! I have the same problem in 2016.!

                    • goblooge Dec 8, 2016 @ 23:26

                      haha… it’s make me laugh…. greetings from indoensia

                    • Fernando Martinez Mar 2, 2017 @ 8:23

                      And here I am in 2017.

                    • Slim Jun 19, 2017 @ 0:56

                      Hello from the year 2017!

                • Another guy Jan 14, 2015 @ 9:09

                  2015 checking in, see you next year

                  • John Doe Feb 27, 2015 @ 18:56

                    You guys made me laugh. See you next year.

                    • mysql Mar 5, 2015 @ 9:23

                      haha.. it will continue..

                  • random_guy Jan 21, 2016 @ 21:48

                    Oh hai, it’s 2016, how you been?

                    • gray-NIN Sep 23, 2016 @ 6:10

                      nice! (leaving this for future references and also amusement. *smiley* )

        • Amritesh Ganiger Nov 29, 2016 @ 19:34

          And, I am here replying after 4 years, 6 months, 1 week, 6 days (1658 days) xD

  • Anonymous Apr 29, 2006 @ 13:16

    THANKS!
    SAVED MY ASS!

    • Arnab Mar 8, 2011 @ 11:56

      Thanks , it really works

    • travb Oct 22, 2011 @ 23:44

      You can recover MySQL database server password with following five EASY steps.

      Why is it that EVERYTIME someone writes something is easy, it is not?

      I have no idea how to shut off mysql. And there is no explanation here.

      • NNII Dec 28, 2011 @ 20:32

        yes, it does in fact have how – /etc/init.d/mysqld stop

      • Joe Apr 11, 2013 @ 16:39

        I had the same problem ‘mysql stop’ required a password 🙁
        In a terminal on the command line as system root:

        root@localhost# ps -A
        PID      TTY  TIME          CMD
        ....
        23386  ?       00:00:00   mysqld_safe
        23543  ?       00:00:00   mysqld
        ....
        root@localhost# kill -9 23543
        root@localhost# kill -9 23386
        root@localhost# ps -A
        

        Look through the list of processes and confirm the processes were killed.
        Continue with step #2

        • Márcio Jan 23, 2014 @ 1:09

          I am at lubuntu 13.04 and i Can’t use mysqld commands
          i.e when i use # /etc/init.d/mysql stop

          This is shown on terminal:

          “Rather than invoking init scripts through /etc/init.d, use the service(8)
          utility, e.g. service mysql stop

          Since the script you are attempting to invoke has been converted to an
          Upstart job, you may also use the stop(8) utility, e.g. stop mysql”

          when I use # mysqld_safe –skip-grant-tables &
          this is shown:

          140122 23:07:14 mysqld_safe Can’t log to error log and syslog at the same time. Remove all –log-error configuration options for –syslog to take effect.
          140122 23:07:14 mysqld_safe Logging to ‘/var/log/mysql/error.log’.
          140122 23:07:14 mysqld_safe A mysqld process already exists

          (I think this post are a bit old)

          • Márcio Jan 23, 2014 @ 1:20

            Worked to me after using ps -A to check what process is running Mysql then Killing it with kill command, after I folowed the steps and worked well. Tanks!
            This post Is OLD BUT GOLD!

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @ webmaster@cyberciti.biz