自从我完成mysql以来已经有一段时间了。我想要做的是从以下数据库创建脚本中删除所有“prs_db”冗余。我该怎么做?
CREATE DATABASE `prs_db`;
GRANT
SELECT, INSERT, UPDATE, DELETE, LOCK TABLES, EXECUTE
ON
`prs_db`.*
TO
'prs'@'%' IDENTIFIED BY 'freakingSecret';
GRANT
ALTER, ALTER ROUTINE, CREATE, CREATE ROUTINE, CREATE TEMPORARY TABLES, CREATE VIEW, DELETE,
DROP, EXECUTE, INDEX, INSERT, LOCK TABLES, SELECT, SHOW VIEW, TRIGGER, UPDATE
ON
`prs_db`.*
TO
'prs_admin'@'%' IDENTIFIED BY 'evenMoreSecretShhhh';
FLUSH PRIVILEGES;
答案 0 :(得分:2)
在CREATE
之后添加USE
statement
CREATE DATABASE `prs_db`;
USE `prs_db`;
USE
语句导致 MySQL将db_name
数据库用作后续语句的默认(当前)数据库