MySQL 用戶和權限管理
阿新 • • 發佈:2018-03-08
mysql 用戶權限Mysql修改密碼的方式
如果忘記密碼--skip-grant-tables
1、alter user
alter user test@'localhost' identified by 'xxxx!';
2、grant
show grants for test@'localhost'; GRANT USAGE ON *.* TO 'test'@'localhost' IDENTIFIED BY PASSWORD '*xxxxxxxxxxxxx';
GRANT USAGE ON *.* TO 'test'@'localhost' IDENTIFIED BY 'xxxxxxxxxxxxx';
3、set password
set password for test@'localhost'=password('xxx')
4、update mysql.user
mysql> UPDATE mysql.user SET Password = PASSWORD('newpass') WHERE user = 'test' and host='localhost'; mysql> FLUSH PRIVILEGES;
5、mysqladmin
mysqladmin -u test password "newpass" #第一次設置 mysqladmin -u test password oldpass "newpass" #如果root已經設置過密碼,采用如下方法
MySQL 用戶和權限管理