Change MySQL Admin password

[root@fedora12 user1]# mysqladmin -u root password 123456
[root@fedora12 user1]# mysqladmin -u root password 123456
mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘root‘@’localhost’ (using password: NO)’
[root@fedora12 user1]# mysqladmin -u root -p’123456′ password 123456
[root@fedora12 user1]#
When Password is not set
[root@fedora12 user1]# mysqladmin -u root password 123456
After Set this will not work
If you have never set a root password for MySQL, the server does not require a password at all for connecting as root. To setup root password for first time, use mysqladmin command at shell prompt as follows:

[root@fedora12 user1]# mysqladmin -u root password 123456
mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘root’@'localhost’ (using password: NO)’
To change existing Password
[root@fedora12 user1]# mysqladmin -u root -p’123456′ password 123456
[root@fedora12 user1]#

Change MySQL password for other user

To change a normal user password you need to type (let us assume you would like to change password for meabi):

$ mysqladmin -u meabi -p oldpassword password newpass

Changing MySQL root user password using MySQL sql command

This is another method. MySQL stores username and passwords in user table inside MySQL database. You can directly update password using the following method to update or change password for user meabi:

1) Login to mysql server, type following command at shell prompt:

$ mysql -u root -p

2) Use mysql database (type command at mysql> prompt):

mysql> use mysql;

3) Change password for user meabi:

mysql> update user set password=PASSWORD("NEWPASSWORD") where User='meabi';

4) Reload privileges:

mysql> flush privileges;
mysql> quit

  • Meet Author

    S.Abhilash, started this blog in the later half of 2009 as a self hosting site for all his previous blogging attempts. , My way of writing and frequency of publishing may not be uniform as my resources are my projects nd issues i came across. For the last few years this blog is reacing 100 s of unique visitors each day, thanks wordpress and google for such a perfection in their software and services.

    Head to Authors Page | Abhilash on Facebook



Category Linux, MySQL     Tags , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Comment on Facebook

1 Comment to “Change MySQL Admin password”

Community



FREE News Letter

Enter your email address

See Also

Resources

Please Submit your Email Address to Get Latest Technology News As it Happens


Enter your email address


Read previous post:
google ad

This post confirms my ownership of the site and that this site adheres to Google AdSense program policies and Terms...

Close