-- 创建数据库
CREATE DATABASE `light` DEFAULT CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI;

-- 允许本地连接 账户为 admin / iB0iec9Y 允许操作light数据库
GRANT USAGE ON *.* TO `admin`@`localhost` IDENTIFIED BY 'iB0!ec9Y';
GRANT ALL PRIVILEGES ON light.* TO `admin`@`localhost`;

-- 允许外部连接 账户为 admin / iB0iec9Y 允许操作light数据库
GRANT USAGE ON *.* TO `admin`@`%` IDENTIFIED BY 'iB0!ec9Y';
GRANT ALL PRIVILEGES ON light.* TO `admin`@`%`;

FLUSH PRIVILEGES;

-- 重置root密码:
--   初始密码需要查看/var/log/mysqld.log日志中, 'temporary password'的内容
--   所有的操作需要先修改密码以后才执行
--   >mysql -uroot -pRqRIU5+Y?gLv
--   >ALTER USER 'root'@'localhost' IDENTIFIED BY 'A1phabets!'
