Linux Tip of the Day - Reset MYSQL password
If you forgot your mysql password and you have root access in your linux box, just follow this steps.
1. Stop MYSQL service
# /etc/init.d/mysql stop
or
# service mysqld stop
2. Start MYSQLl without password.
# mysqld_safe –skip-grant-tables &
and the output is:
Output:
[1] 5988
then press enter.
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>
4. Create a new MYSQL password.
mysql> use mysql;
mysql> update user set password=PASSWORD(”NEW-ROOT-PASSWORD”) where User=’root’;
mysql> flush privileges;
mysql> quit
5. Restart MYSQL service
# /etc/init.d/mysql restart
or
# service mysqld restart
Comments
5 Comments on Linux Tip of the Day - Reset MYSQL password
-
FuzzLinks.com » Linux Tip of the Day - Reset MYSQL password | on
Wed, 23rd Jul 2008 5:39 pm
-
mtux on
Wed, 23rd Jul 2008 9:13 pm
-
Linux Tip of the Day - Reset MYSQL password : HowtoMatrix on
Wed, 23rd Jul 2008 11:42 pm
-
Wodin on
Thu, 24th Jul 2008 3:31 am
-
links for 2008-07-25 « My place on
Fri, 25th Jul 2008 8:41 am
it doesn’t work for me. ![]()
results is:
mtux@mtux-laptop:~$ sudo /etc/init.d/mysql stop
* Stopping MySQL database server mysqld [ OK ]
mtux@mtux-laptop:~$ sudo mysqld_safe –skip-grant-tables &
[1] 31154
mtux@mtux-laptop:~$ nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[31193]: started
STOPPING server from pid file /var/run/mysqld/mysqld.pid
mysqld_safe[31199]: ended
[1]+ Done sudo mysqld_safe –skip-grant-tables
mtux@mtux-laptop:~$ sudo mysql -u root
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
[...] Read more at dralnux [...]
mtux: It might be configured not to listen on a Unix domain socket.
See if this works: mysql -u root -h localhost
[...] Linux Tip of the Day - Reset MYSQL password | If you forgot your mysql password and you have root access in your linux box, just follow this steps. (tags: howto database linux password recovery reset root security mysql) [...]
Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!
