Home > docs, GNU/Linux, tiny post, tips, ubuntu > How to set or reset password mysql on Ubuntu

How to set or reset password mysql on Ubuntu


reset

reset

I’ve was succesfully install mysql on my friends machine 🙂 . After do that i need set new password for replace balnk passsword. This post is tiny psoting. So, this not recommanded for advanced user 😆 . ok.

sometimes, after fresh installation i use command like this to set new password root on mysql :

mysqladmin  -u root password newpassword

but it doesn’t work. I’ve got some error message:

mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'

Try to recover, so i need to stop mysql daemon

sudo /etc/rc5.d/S19mysql stop

then start mysql daemon again with skip grant tables and netwoking:

sudo mysqld --skip-grant-tables --skip-networking

now, mysql daemon running with skip grant tables and networking. we can login without password 😆

mysql -u root

then, update for new password

mysql> update mysql.user set password=password('toor') where user='root';

don’t forget to flush privilages 😉

mysql> flush privileges;

type quit and try again to login without password

mysql> quit
Bye
[zie: ]$ mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[zie: ]$

it’s work 😉 ..

some loggs can be see on here and here

Thanks to:

– zie, for the machine 😀

Reference:

Ubuntu Help
– picture from www.toonpool.com

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s