一、创建用户
CREATE USER '用户名'@'%' IDENTIFIED BY '密码';
flush privileges;
二、更新用户密码
update mysql.user set authentication_string=password("密码") where user='root';
flush privileges;
三、允许root远程登录
update user set host = '%' where user = 'root';
flush privileges;
四、授权,可重新设置密码
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
flush privileges;
五、创建数据库,并指定字符编码
create database 库 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;