mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
3308d8794e
Fix is to remove any references to the current hostname when running mysql_install_db --cross-bootstrap. (The dist-hook make target makes this call, and the resulting data directory is included in the source distribution as win/data/*.) Also, a few other clean-ups to mysql_install_db while there. Makefile.am: Adapt to clean-up in mysql_install_db (--windows becomes --cross-bootstrap) scripts/mysql_install_db.sh: Filter out references to the current hostname when performing a cross-bootstrap installation by removing any lines which contain the string "@current_hostname". Deprecate the old --windows option; use --cross-bootstrap instead, since it more accurately reflects the purpose. Other clean-up: the wrong syntax was being used to test the exit status of mysqld --bootstrap. It mostly worked, as long as mysqld succeeded. However, it was not robust. scripts/mysql_system_tables_data.sql: Rename local @hostname variable to @current_hostname, which is a more unique label to search on. mysql_install_db now filters out all lines which include "@current_hostname" during a --cross-bootstrap installation.
29 lines
1.7 KiB
SQL
29 lines
1.7 KiB
SQL
--
|
|
-- The inital data for system tables of MySQL Server
|
|
--
|
|
|
|
-- When setting up a "cross bootstrap" database (e.g., creating data on a Unix
|
|
-- host which will later be included in a Windows zip file), any lines
|
|
-- containing "@current_hostname" are filtered out by mysql_install_db.
|
|
set @current_hostname= @@hostname;
|
|
|
|
|
|
-- 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;
|
|
|
|
|
|
-- 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 (@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','','','','',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 tmp_user (host,user) VALUES ('localhost','');
|
|
INSERT INTO tmp_user (host,user) VALUES (@current_hostname,'');
|
|
INSERT INTO user SELECT * FROM tmp_user WHERE @had_user_table=0;
|
|
DROP TABLE tmp_user;
|