Suppose you wish to start MySQL using a startup script and not through systemd
, especially for testing or for some temporary change. You can pass the variables to the script rather than changing it in the config file.
shell> /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/centos7.err --pid-file=/usr/local/mysql/data/centos7.pid --init-file=/tmp/mysql-init &
You can see that the --init-file
parameter is passed to the server. The server executes the SQL statements in that file before starting.