diff options
author | msvensson@pilot.blaudden <> | 2007-04-12 17:48:28 +0200 |
---|---|---|
committer | msvensson@pilot.blaudden <> | 2007-04-12 17:48:28 +0200 |
commit | 74dfba96e73bb00feb518f070ac41c10891965f7 (patch) | |
tree | d90401d6f87fe7b3a2e7eb08acf291815e67c2cd /scripts/mysql_system_tables_data.sql | |
parent | cd2f78fdd8d9eb15e6feb9c600f83b909e2c7e08 (diff) | |
download | mariadb-git-74dfba96e73bb00feb518f070ac41c10891965f7.tar.gz |
Bug#27783 mysql_install_db should be able to install again, preserving existing files.
- Allow mysql_install_db to be run a second time in the same
datadir to create and fill any missing system tables
Diffstat (limited to 'scripts/mysql_system_tables_data.sql')
-rw-r--r-- | scripts/mysql_system_tables_data.sql | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/scripts/mysql_system_tables_data.sql b/scripts/mysql_system_tables_data.sql index a9c816f2896..5f0289ab197 100644 --- a/scripts/mysql_system_tables_data.sql +++ b/scripts/mysql_system_tables_data.sql @@ -2,12 +2,20 @@ -- The inital data for system tables of MySQL Server -- --- default grants for anyone to access database 'test' and 'test_%' -INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N'); -INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N'); +-- Fill "db" table with default grants for anyone to +-- access database 'test' and 'test_%' if "db" table didn't exist +CREATE TEMPORARY TABLE tmp_db LIKE db; +INSERT INTO tmp_db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N'); +INSERT INTO tmp_db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N'); +INSERT INTO db SELECT * FROM tmp_db WHERE @had_db_table=0; +DROP TABLE tmp_db; --- default users allowing root access from local machine -INSERT INTO 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','','','','',0,0,0,0); -REPLACE INTO user VALUES (@@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','','','','',0,0,0,0); -REPLACE INTO 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','','','','',0,0,0,0); +-- Fill "users" table with default users allowing root access +-- from local machine if "users" table didn't exist before +CREATE TEMPORARY TABLE tmp_user LIKE user; +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','','','','',0,0,0,0); +REPLACE INTO tmp_user VALUES (@@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','','','','',0,0,0,0); +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','','','','',0,0,0,0); +INSERT INTO user SELECT * FROM tmp_user WHERE @had_user_table=0; +DROP TABLE tmp_user; |