- Forums
- MySQL
- How To Reset Mysql Root Password In My Linux Server
the root password is an extremely important information you must protect and guard. sometimes you guard it to much that you forget it, this page will show you how to get your mysql database root password back or atleast reset it [898], Last Updated: Sat May 18, 2024
wallpaperama
Tue Jun 24, 2008
0 Comments
869 Visits
update user set Password=PASSWORD('Gdw3b2n3=2008') WHERE User='root';
ok today for some reason i tried to login to phpmyadmin through the root but i kept getting rejects saying my password was wrong..
i thot i had lost everything. well, if you are in the same situation as i was, where you need to reset your password, you are in luck because i will show you how you can hack it so that you will be able to
NOTE: I TESTED THIS ON FEDORA CORE 7. Should also work on red hat and centos
Stop mysql:
/etc/init.d/mysqld stop
Command:
/usr/bin/mysqld_safe --skip-grant-tables &
Command:
mysql --user=root mysql
YOU WILL SEE:
#############################
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 1
Server version: 5.0.45 Source distribution
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
Command: mysql>
update user set Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root';
NOTE: YOURNEWPASSWORD is whatever password you want the new pasword to be
THEN YOU WILL SEE THIS:
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2 Changed: 2 Warnings: 0
Command: mysql>
flush privileges;
Query OK, 0 rows affected (0.00 sec)
Command: mysql>
exit
Bye
Command:
/etc/init.d/mysqld start
Command:
mysql --user=root --pass=YOURNEWPASSWORD
DONE
now try to login
###########################################################################
these are just my notes on how i started this tutorial.
im keeping it here just in case i need it
###########################################################################
/etc/init.d/mysqld stop
/usr/bin/mysqld_safe --skip-grant-tables &
mysql --user=root mysql
YOU WILL SEE:
#############################
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.45 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>update user set Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root';
##########################
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2 Changed: 2 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
/etc/init.d/mysqld start
mysql --user=root --pass=YOURNEWPASSWORD
now try to login