Re: How to change MySQL root password?
I ran into this the other day and I had to do a little quick fix .... I found this on the net somewhere
shell> kill `cat /mysql-data-directory/hostname.pid`
shell> mysqladmin -u root password 'mynewpassword'
shell> mysqladmin -h hostname flush-privileges
Alternatively, you can set the new password using the mysql client:
1. Take down and restart mysqld with the --skip-grant-tables option as described above.
2. Connect to the mysqld server with: shell> mysql -u root mysql
3. Issue the following commands in the mysql client:
mysql> UPDATE user SET Password=PASSWORD('mynewpassword') -> WHERE User='root';
4. mysql> FLUSH PRIVILEGES;
After this, you should be able to connect using the new password. You can now stop mysqld and restart it normally.
How to change MySQL root password?
Collapse
Unconfigured Ad Widget
Collapse
X
-
How to change MySQL root password?
How to change MySQL root password?
How to change MySQL root password under Linux, FreeBSD, OpenBSD and UNIX like operating system over ssh / telnet session?
mysqladmin command to change root password
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:
$ mysqladmin -u root password NEWPASSWORD
However, if you want to change (or update) a root password, then you need to use following command
$ mysqladmin -u root -p oldpassword newpass
Enter password:
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 ryan):
$ mysqladmin -u ryan -p oldpassword newpassTags: None
-
Leave a comment: