1.创建用户并授权
创建用户user,密码为:mypassword,其可以本地登录,并可以访问任何数据库
grant all privileges on *.* to 'user'@'localhost' identified by 'mypassword'; 本地授权
创建用户user,密码为:mypasword,其可以远程登录,并可以访问任何数据库
grant all privileges on *.* to 'user'@'%' identified by 'mypassword'; 远程授权
flush privileges; #刷新系统权限表
注意:
如果出现
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
则允许 alter user user() identified by '密码';