Overview
Often, people are wondering how to change a password in MySQL.How to change the root password
Root Password
- After first installation
mysqladmin -u root password 'new_root_password'
if the password already exists
mysqladmin -u root -p'oldpassword' password newpassword
Once the root password changed you should change it for all root accounts using the mysql_secure_installation
- Change password using mysqladmin
- Here how to change a password in MySQL
use mysql;
- Change the password for all user where user = 'username'
update user set password=PASSWORD('newpassword') where user='username';
flush privileges;
- Change the password for a specific user
EX: update user set password=PASSWORD('changeme') where user='user1' and host='%';
update user set password=PASSWORD('changeme') where user='user1' and host='192.168.0.10';
or
set password for useryouwanttochange = PASSWORD ( 'new_password' );
No comments:
Post a Comment