Reset MySQL Root Password

Very often, once we didn’t log on to MySQL database for some time, I guess most of us will forgot the root password. Can we reset the root password? Obviously… Nothing is Impossible :P

Follow the steps below to reset MySQL’s Root Password;

  • Stop MySQL Service
  • Start MySQL Service in Safe Mode: /usr/local/bin/mysqld_safe –skip-grant-tables&
  • Connect to MySQL /usr/local/bin/mysql
  • mysql> use mysql;
  • mysql> UPDATE user set password=password(‘newpassword’) where user=’root’ and host=’localhost’;
  • mysql> flush privileges;
  • mysql> quit;
  • Stop MySQL Service Again
  • Start MySQL Service in normal mode

Log in to MySQL with your newly created password.

Related posts:

  1. Create Root Privilege User on MySQL By default, MySQL root privileges user is “root”, I always...
  2. Forget / forgot / cannot remember root password On a FreeBSD server 1. reboot server 2. choose to...
  3. Change or Set User Password in FreeBSD If you notice, during FreeBSD installation, it doesn’t have a...
  4. MySQL Cannot Connect with PHP in OSX I think some of you might have problem connecting to...
  5. MySQL Quick Installation on FreeBSD Quick installation of MySQL Database on FreeBSD Server. Make sure...
  6. Install MySQL5 on Mac OSX With Darwin Port Before installing MySQL5, please be sure you have Darwin Port...
  7. bash – dealing with backtics ” ` ” in mysql statement problem : using backticks in bash for mysql statements. e.g....
  8. Install MySQL5 Server on Apple Mac Leopard with MacPorts Previously I wrote a post on “installing postgresql 8.2 on...
  9. How to Change MySQL Data Directory in Linux Centos By default Linux CentOS or other Linux Distro installation, MySQL...
  10. How to Remove MySQL Binary Log By default, MySQL 5.0 and above enables MySQL Binary Log....

Tags: , , ,

Leave a Reply