为MySQL用户设置密码
1. 设置localhost的访问密码
$ mysqladmim -uroot -hlocalhost -p password '123456'
2. 设置已存在的用户的密码
mysql> set password for 'USERNAME'@'HOST'=password('password');
3. 设置已存在的用户的密码
mysql> update user set Password=password(password') where User='USERNAME' and Host='HOST';
4. 给远程用户设置密码
mysql> grant all privileges on *.* to 'root'@'192.168.31.%' identified by '123456';
mysql> flush privileges;