1) 建立用户(登录帐号)U1、U2、U3、U4、U5、U6、U7和对应的数据库学生课程系统的用户dbu1、dbu2、dbu3、dbu4、dbyu5、dbu6、dbu7。
时间: 2023-11-29 08:45:57 浏览: 187
以下是建立用户和对应数据库的SQL语句:
```
-- 建立用户U1和对应的数据库dbu1
CREATE USER 'U1'@'localhost' IDENTIFIED BY 'password1';
CREATE DATABASE IF NOT EXISTS dbu1 DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON dbu1.* TO 'U1'@'localhost';
-- 建立用户U2和对应的数据库dbu2
CREATE USER 'U2'@'localhost' IDENTIFIED BY 'password2';
CREATE DATABASE IF NOT EXISTS dbu2 DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON dbu2.* TO 'U2'@'localhost';
-- 建立用户U3和对应的数据库dbu3
CREATE USER 'U3'@'localhost' IDENTIFIED BY 'password3';
CREATE DATABASE IF NOT EXISTS dbu3 DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON dbu3.* TO 'U3'@'localhost';
-- 建立用户U4和对应的数据库dbu4
CREATE USER 'U4'@'localhost' IDENTIFIED BY 'password4';
CREATE DATABASE IF NOT EXISTS dbu4 DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON dbu4.* TO 'U4'@'localhost';
-- 建立用户U5和对应的数据库dbu5
CREATE USER 'U5'@'localhost' IDENTIFIED BY 'password5';
CREATE DATABASE IF NOT EXISTS dbu5 DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON dbu5.* TO 'U5'@'localhost';
-- 建立用户U6和对应的数据库dbu6
CREATE USER 'U6'@'localhost' IDENTIFIED BY 'password6';
CREATE DATABASE IF NOT EXISTS dbu6 DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON dbu6.* TO 'U6'@'localhost';
-- 建立用户U7和对应的数据库dbu7
CREATE USER 'U7'@'localhost' IDENTIFIED BY 'password7';
CREATE DATABASE IF NOT EXISTS dbu7 DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON dbu7.* TO 'U7'@'localhost';
```
请注意,这里的密码只是示例,请根据实际情况设置更安全的密码。
阅读全文