Skip to content

Commit 97b4686

Browse files
committed
MDEV-7021 allow config file parameter for mysql_install_db.exe
The new parameter is called --config The config file is copied to the data directory as my.ini, and possibly modified. Bootstrap will now use my.ini to create tables. In case of non-standard directory/file placements, this will ensure correct permissions for the service user. mysql_install_db_win test is extended to test --config with non-trivial config file.
1 parent e2bc029 commit 97b4686

File tree

4 files changed

+238
-108
lines changed

4 files changed

+238
-108
lines changed

mysql-test/main/mysql_install_db_win.result

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Running bootstrap
2+
Creating my.ini file
23
Removing default user
34
Allowing remote access for user root
45
Setting root password
5-
Creating my.ini file
66
Creation of the database was successful
77
# Kill the server
88
# restart: --datadir=MYSQLTEST_VARDIR/tmp/ddir --loose-innodb
@@ -12,4 +12,24 @@ SELECT @@datadir;
1212
DATADIR/
1313
# Kill the server
1414
connection default;
15+
[mysqld]
16+
long_query_time=15.000000
17+
#slow_query_log_file=l:/errorlog/mariadb.slow.log
18+
slow_query_log_file=BASEDIR/data/slow_query_log_01.log
19+
datadir=BASEDIR/data
20+
server-id=1
21+
port=3307
22+
#tmpdir=C:/mysql_tmpdir
23+
tmpdir=BASEDIR/temp
24+
innodb_data_file_path=ibdata1:10M;ibdata2:10M:autoextend
25+
innodb_log_group_home_dir=BASEDIR/data
26+
skip-name-resolve
27+
28+
#*********************************************************
29+
# performance_schema
30+
#*********************************************************
31+
performance_schema=OFF
32+
33+
[client]
34+
port=3307
1535
# restart

mysql-test/main/mysql_install_db_win.test

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,39 @@ SELECT @@datadir;
2020
rmdir $ddir;
2121
let $restart_parameters=;
2222
connection default;
23+
24+
# Test --template option
25+
let _BASEDIR = $MYSQLTEST_VARDIR/tmp/basedir;
26+
perl;
27+
28+
open(IN, '<', "std_data/mysql_install_db_win.ini.in") or die;
29+
open(OUT, '>', "$ENV{MYSQLTEST_VARDIR}/tmp/mysql_install_db_win.ini") or die;
30+
while (<IN>) {
31+
s/BASEDIR/$ENV{_BASEDIR}/g;
32+
print OUT $_;
33+
}
34+
close IN;
35+
close OUT
36+
EOF
37+
mkdir $_BASEDIR;
38+
mkdir $_BASEDIR/temp;
39+
40+
# Run mysql_install_db.exe with config parameter
41+
--disable_result_log
42+
exec $MYSQL_INSTALL_DB_EXE -o --port=3307 --config=$MYSQLTEST_VARDIR/tmp/mysql_install_db_win.ini;
43+
--enable_result_log
44+
45+
# dump the modified config in data directory
46+
perl;
47+
open(IN, '<', "$ENV{_BASEDIR}/data/my.ini") or die;
48+
while (<IN>) {
49+
s/$ENV{_BASEDIR}/BASEDIR/g;
50+
# when testing on installation layout, client's plugin
51+
# dir is added, but when testing in build dir.
52+
print unless $_ =~ /plugin-dir/;
53+
}
54+
close IN;
55+
EOF
56+
rmdir $_BASEDIR;
2357
--source include/start_mysqld.inc
2458

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[mysqld]
2+
long_query_time=15.000000
3+
#slow_query_log_file=l:/errorlog/mariadb.slow.log
4+
slow_query_log_file=BASEDIR/data/slow_query_log_01.log
5+
datadir=BASEDIR/data/
6+
server-id=1
7+
port=3306
8+
#tmpdir=C:/mysql_tmpdir
9+
tmpdir=BASEDIR/temp
10+
innodb_data_file_path=ibdata1:10M;ibdata2:10M:autoextend
11+
innodb_log_group_home_dir=BASEDIR/data
12+
skip-name-resolve
13+
14+
#*********************************************************
15+
# performance_schema
16+
#*********************************************************
17+
performance_schema=OFF
18+

0 commit comments

Comments
 (0)