1.删除数据库,不建议该操作;
drop database if EXISTS light;
2.创建数据库,并设置编码格式;
create database IF NOT EXISTS light DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci;
3.删除用户,不建议该操作;
drop user if EXISTS light;
4.创建用户;
create user IF NOT EXISTS 'light'@'%';
5.设置密码;
ALTER USER 'light'@'%' IDENTIFIED WITH mysql_native_password BY 'light';
6.赋权
grant all privileges on light.* to 'light'@'%' ;
flush privileges;