Home >Database >Mysql Tutorial >How to change mysql username and password
How to modify the user name and password of mysql: first log in to mysql; then execute the [UPDATE user SET password] command to change the password; then execute the [update user set user] command to modify the user name; and finally refresh the permissions.
The specific method is as follows:
(Video tutorial recommendation: mysql video tutorial)
Modification Password:
mysql -u root -p Enter password:*** mysql>use mysql; 选择数据库 Database changed mysql> UPDATE user SET password=PASSWORD("新密码") WHERE user='你的用户名'; mysql> FLUSH PRIVILEGES; mysql> quit;
(Related recommendations: mysql tutorial)
Modify user name:
mysql -u root -p Enter password:*** mysql> use mysql; 选择数据库 Database changed mysql> update user set user="新用户名" where user="root"; 将用户名为root的改为新用户名 mysql> flush privileges; 刷新权限 mysql> exit
The above is the detailed content of How to change mysql username and password. For more information, please follow other related articles on the PHP Chinese website!