1
by brian
clean slate |
1 |
--
|
2 |
-- The inital data for system tables of MySQL Server |
|
3 |
--
|
|
4 |
||
5 |
-- When setting up a "cross bootstrap" database (e.g., creating data on a Unix |
|
6 |
-- host which will later be included in a Windows zip file), any lines |
|
7 |
-- containing "@current_hostname" are filtered out by mysql_install_db. |
|
8 |
set @current_hostname= @@hostname; |
|
9 |
||
10 |
||
11 |
-- Fill "db" table with default grants for anyone to |
|
12 |
-- access database 'test' and 'test_%' if "db" table didn't exist |
|
13 |
CREATE TEMPORARY TABLE tmp_db LIKE db;
|
|
14 |
INSERT INTO tmp_db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y'); |
|
15 |
INSERT INTO tmp_db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y'); |
|
16 |
INSERT INTO db SELECT * FROM tmp_db WHERE @had_db_table=0;
|
|
17 |
DROP TABLE tmp_db;
|
|
18 |
||
19 |
||
20 |
-- Fill "users" table with default users allowing root access
|
|
21 |
-- from local machine if "users" table didn't exist before |
|
22 |
CREATE TEMPORARY TABLE tmp_user LIKE user; |
|
23 |
set @current_hostname= @@hostname; |
|
24 |
INSERT INTO tmp_user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); |
|
25 |
REPLACE INTO tmp_user VALUES (@current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); |
|
26 |
REPLACE INTO tmp_user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); |
|
27 |
INSERT INTO tmp_user (host,user) VALUES ('localhost',''); |
|
28 |
INSERT INTO tmp_user (host,user) VALUES (@current_hostname,''); |
|
29 |
INSERT INTO user SELECT * FROM tmp_user WHERE @had_user_table=0; |
|
30 |
DROP TABLE tmp_user; |