diff --git a/man/mysql_install_db.1 b/man/mysql_install_db.1 index 9e4d0a96882..237efaef9df 100644 --- a/man/mysql_install_db.1 +++ b/man/mysql_install_db.1 @@ -345,6 +345,21 @@ runs using your current login name and files and directories that it creates wil .sp -1 .IP \(bu 2.3 .\} +.\" mysql_install_db: extra-file option +.\" extra-file option: mysql_install_db +\fB\-\-extra-file=\fR\fB\fIfile_path\fR\fR +.sp +Add user defined SQL file, to be executed following regular database initialization. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysql_install_db: verbose option .\" verbose option: mysql_install_db \fB\-\-verbose\fR diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index f32002f996e..42bfdc15314 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -40,6 +40,7 @@ cross_bootstrap=0 auth_root_authentication_method=socket auth_root_socket_user="" skip_test_db=0 +extra_file="" dirname0=`dirname $0 2>/dev/null` dirname0=`dirname $dirname0 2>/dev/null` @@ -95,6 +96,8 @@ Usage: $0 [OPTIONS] user. You must be root to use this option. By default mysqld runs using your current login name and files and directories that it creates will be owned by you. + --extra-file=file Add user defined SQL file, to be executed following + regular database initialization. All other options are passed to the mysqld program @@ -178,6 +181,8 @@ parse_arguments() --auth-root-socket-user=*) auth_root_socket_user="$(parse_arg "$arg")" ;; --skip-test-db) skip_test_db=1 ;; + --extra-file=*) + extra_file="$(parse_arg "$arg")" ;; *) if test -n "$pick_args" @@ -399,6 +404,13 @@ do fi done +# Verify extra file exists if it's not null +if test ! -z "$extra_file" -a ! -f "$extra_file" +then + cannot_find_file "$extra_file" + exit 1 +fi + if test ! -x "$mysqld" then cannot_find_file "$mysqld" @@ -554,6 +566,12 @@ cat_sql() then cat "$mysql_test_db" fi + + # cat extra file if it's not null + if test ! -z "$extra_file" + then + cat "$extra_file" + fi } # Create the system and help tables by passing them to "mysqld --bootstrap"