SQL代码
- insert into mysql.user(Host,User,Password) values ("%","admin",password("cnmo"));
- CREATE USER 'admin'@'localhost' IDENTIFIED BY 'cnmo';
- GRANT privileges ON *.* TO 'admin'@'localhost';
- GRANT ALL privileges on *.* to 'admin'@'localhost' identified by 'cnmo';
- FLUSH PRIVILEGES;
更新用户密码
SQL代码
- use mysql # 连接权限数据库
- update user set password=password('521') where user='root' and host='localhost'; # 改密码
- flush privileges; # 刷新权限