You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.8 KiB

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