Linux下为MySQL设置密码
时间:2008-05-01 来源:sdccf
1. 命令行更改: mysqladmin password 新密码 例如, dos(或者liunx)下mysql的bin目录下,mysqladmin password 123456 2. 用MYSQL的grant语句,例如 GRANT ALL ON *.* TO 'root'@'localhost' IDENTIFIED BY '123456' WITH GRANT OPTION 3. SET PASSWORD FOR '用户名'@'主机' = PASSWORD('密码') 例如设置root密码为123456,SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456'); 4. UPDATE user SET Password=PASSWORD('新密码') WHERE User='用户名' AND Host = '主机'; 例如,UPDATE user SET Password=PASSWORD('123456') WHERE User='root' AND Host = 'localhost';flush priviliges; |
相关阅读 更多 +