1,授权用户远程访问
grant all privileges on *.* to ‘username‘@‘%‘ identified by ‘password‘ with grant option;
flush privileges;
2,登录
mysql -u"username" -p"pwd" -hlocalhost -P3306
3,创建只读帐户
GRANT SELECT ON *.* TO ‘username_r‘@‘localhost‘ IDENTIFIED BY ‘pwd‘;
4,创建读写账户
GRANT ALL ON *.* TO ‘username_r‘@‘localhost‘ IDENTIFIED BY ‘pwd‘;