Create MySQL servers
This chapter presents the MySQL server creation script “mcreate.sh”
"mcreate.sh” performs all creation MySQL Server creation steps and furthermore.
Creation of the admin and data directories
Creation of the MYSQL_SERVER based on mysql_install_db (official MySQL script)
Starting with MySQL 5.7 the new script “mysqld” is used with
the option “—initializer-insecure” in order to freely set the root password
Creation of the schema multi_admin (script mysqld_multi)
Creation of the MySQL client option file ($MYSQL_BASE/admin/$MYSQL_SERVER/.my.cnf)
Extension of the MySQL server option file ($MYSQL_CNF – etc/my.cnf)
Secure MYSQL_SERVER based on mysql_secure_installation (official MySQL script)
Automatic port matching with the MYSQL_SERVER digit (see response file)
The execution of "mcreate.sh” requires a configuration file and a response file. The configuration file contains administrative information (users, password, directories) and the response file contains server specific information (all information required for the MYSQL_SERVER in the MySQL server option file).
Parameters
–h or –help
Display the Synopsis.
–s or –-sid
The MYSQL_SERVER name you wish to create. This parameter is always required:
Two options can be used for mcreate.sh script:
Format mysqldX or only a number X: X is a number between 1 and 9, corresponding to the port 3300X.
e.g.: “mysqld4” or “4” are equivalent
Custom name: it will create the instance in the first slot available founded.
e.g., “master-vmoraoel05”
It will add a line to the $DMK_HOME/etc/instance.cnf file:
⚠️ It is not recommended to edit manually the $DMK_HOME/etc/instance.cnf file, especially if you are using special characters.
–c or --configfile
The dbi services best practice consists of saving the configuration file under $DMK_HOME/etc which makes the command-line parameter “ConfigFile” useless.
Otherwise, the command-line parameter becomes mandatory
An option is to create a symbolic link of the response file you want to use from $DMK_HOME/templates/mcreate.rsp_version under $DMK_HOME/etc
Here is used the response file for MariaDB 10.7:
For simplicity, the parameter -r | --release can also be used, which auto create/update the symbolic link.
r or –release
A specific version of MySQL can be used, several method can be used. It will automatically create or update a symbolic link of the response file you want to use from $DMK_HOME/templates/mcreate.rsp_version under $DMK_HOME/etc
e.g. with MySQL 8.0.16 with different ways to use it:
It will create a symbolic link for the asked release if every followed conditions are validated:
The MySQL source of this release is present in the system
The response file exists in $DMK_HOME/templates/mcreate.rsp_version directory respecting the format: mcreate.rsp_v[VERSION]
⚠️If the response file according to your MySQL doesn't exist, you have to create a new response file. Create your reponse file in the $DMK_HOME/templates/mcreate.rsp_version directory.
Configuration file
The configuration file contains the following parameters:
⚠️ The parameter tpl_server_cnf is required as it contains all information regarding the MYSQL_SERVER configuration, which will be added to the MySQL server option file.
⚠️ Configuration files hasn't been tested for all version of MySQL. You can find different templates in DMK templates directory. Please feel free to adapt/add/remove any parameter in coherence with your MySQL release. Several configuration files can coexist.
Response file
ℹ️ The MySQL server specified as argument to the script is automatically appended in place of the placeholders “<MYSQL_SERVER>”. The placeholder „<STD_PORT>“ is replaced by the last digits of the MYSQL_SERVER specified as argument.
Last updated