For every database administrator it is essential to know the methods of resetting root password in case if it is forgotten by them. For mysql, the system administrator is called root. You will use the mysqladmin utility from a command line to set the new password. Notice that there are two commands to be run.
Syntax:
mysqladmin -u root password “newpassword”
mysqladmin -u root -h host_name password “newpassword”
Example:
mysqladmin -u root password ws8dr8as3
mysqladmin -u root -h localhost password ws8dr8as3
You will also want to restart the database server after running this command
sudo /etc/init.d/mysql restart
How to change MySQL user password using UPDATE command in MySQL?
mysql> UPDATE user SET password=PASSWORD('newpassword') WHERE user='santosh';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Change MySQL root user password using mysql command:
MySQL stores username and passwords in user table inside MySQL database. You can directly update or change the password using the following method for the user santosh.
Login to mysql server, type the following command at shell prompt:
$ mysql -u root -p
Use mysql database (type command at mysql> prompt):
mysql> use mysql;
Change password for user santosh, enter:
mysql> update user set password=PASSWORD("NEWPASSWORD") where User='santosh';
Finally, reload the privileges:
mysql> flush privileges;
mysql> quit
Syntax:
mysqladmin -u root password “newpassword”
mysqladmin -u root -h host_name password “newpassword”
Example:
mysqladmin -u root password ws8dr8as3
mysqladmin -u root -h localhost password ws8dr8as3
You will also want to restart the database server after running this command
sudo /etc/init.d/mysql restart
How to change MySQL user password using UPDATE command in MySQL?
mysql> UPDATE user SET password=PASSWORD('newpassword') WHERE user='santosh';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Change MySQL root user password using mysql command:
MySQL stores username and passwords in user table inside MySQL database. You can directly update or change the password using the following method for the user santosh.
Login to mysql server, type the following command at shell prompt:
$ mysql -u root -p
Use mysql database (type command at mysql> prompt):
mysql> use mysql;
Change password for user santosh, enter:
mysql> update user set password=PASSWORD("NEWPASSWORD") where User='santosh';
Finally, reload the privileges:
mysql> flush privileges;
mysql> quit
No comments:
Post a Comment