> For the complete documentation index, see [llms.txt](https://dbi-services.gitbook.io/dmk-mariadb-manual/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dbi-services.gitbook.io/dmk-mariadb-manual/servers-management/create-mariadb-servers.md).

# Create MariaDB servers

"mcreate.sh” performs all creation MariaDB 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 MariaDB client option file ($MYSQL\_BASE/admin/$MYSQL\_SERVER/.my.cnf)
* Extension of the MariaDB 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 MariaDB 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:

```jsx
mcreate.sh –s ${MYSQL_SERVER}
```

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

```jsx
mcreate.sh –s mysqld4
mcreate.sh –s 4
```

* Custom name: it will create the instance in the first slot available founded.

  e.g., “master-vmoraoel05”

```jsx
mcreate.sh –s master-vmoraoel05
```

It will add a line to the $DMK\_HOME/etc/instance.cnf file:

```jsx
mysqld7=master-vmoraoel05
```

:warning: 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.

```jsx
cp ${DMK_HOME}/templates/mcreate.cfg ${DMK_HOME}/etc
```

Otherwise, the command-line parameter becomes mandatory

```bash
mcreate.sh –s ${MYSQL_SERVER} –c <path to configuration file>
```

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:

```bash
ln -s $DMK_HOME/templates/mcreate.rsp_version/mcreate.rsp_v10.7 ${DMK_HOME}/etc/mcreate.rsp
```

For simplicity, the parameter -r | --release can also be used, which auto create/update the symbolic link.

### r or –release

A specific version of MariaDB 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

```jsx
mcreate.sh –s ${MYSQL_SERVER} –r <MariaDB release>
```

e.g. with MariaDB 10.7 with different ways to use it:

```jsx
mcreate.sh –s ${MYSQL_SERVER} --release 10.8
mcreate.sh –s ${MYSQL_SERVER} -r 10.8.6
mcreate.sh –s ${MYSQL_SERVER} -r 10.8.4
```

It will create a symbolic link for the asked release if every followed conditions are validated:

* The MariaDB 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]

:information\_source:You can also create new response file you want to use, especially for response file not in the $DMK\_HOME/templates/mcreate.rsp\_mariadb10X directory.

e.g. for MariaDB 11.x: the response file and symbolic link have to be created and adapted:

```jsx
> cd $DMK_HOME/templates/mcreate.rsp_version/
> sed 's/1010/1011/g' mcreate.rsp_v10.10 > mcreate.rsp_v10.11
> ln -sf $DMK_HOME/templates/mcreate.rsp_version/mcreate.rsp_v10.11 ${DMK_HOME}/etc/mcreate.rsp
```

### Configuration file

The configuration file contains the following parameters:

```jsx
mysql@vmoel58:/home/mysql/ [mysqld1] cat ${DMK_HOME}/etc/mcreate.cfg
#Define all mcreate parameters
# admin directory and datadir location
mysql_base = /u01/app/mysql
mysql_data = /u02/mysqldata

#User/Client specific options ( $MYSQL_BASE/admin/$MYSQL_SERVER/.my.cnf)
#[client_cnf]
client_user = root
client_password = manager

#mysqld_multi information, used for MySQL server option file (/etc/my.cnf)
mysqld_multi_user = multi_admin
mysqld_multi_password = manager

#MySQL Server specific options (/etc/my.cnf)
# Contains the definition for the MYSQL_SERVER
#[server_cnf]
tpl_server_cnf=/u01/app/mysql/local/dmk/etc/mcreate.rsp

#[post_install]
#dbi services best practices
#post creation SQL script
# Start the MYSQL_SERVER after creation
start_mysql_server = yes
# Secure the installation
# Note: mysql_secure_installation not yet running in "silent/batch" mode
# Please run the mysql_secure.sql SQL Script
#mysql_secure_installation = yes
# Launch a script after MYSQL_SERVER creation (as ROOT) to secure the MySQL
installation
sql_script = /u01/app/mysql/local/dmk/sql/mysql_secure.sql
```

:warning: The parameter tpl\_server\_cnf is required as it contains all information regarding the MYSQL\_SERVER configuration, which will be added to the MariaDB server option file.

:warning: **Configuration files has been tested for new version of MariaDB (10.10). You can find different templates in DMK templates directory. Please feel free to adapt/add/remove any parameter in coherence with your MariaDB release. Several configuration files can coexist.**

### Response file

```
mysql@vmoel58:/home/mysql/ [mysqld1] cat ${DMK_HOME}/etc/mcreate.rsp
#MySQL Server specific options (/etc/my.cnf)
#[server_cnf]
# the port number correspond to the last digits of the MYSQL_SERVER

port = 3300<STD_PORT>
bind-address = localhost
mysqladmin = <MYSQL_BASE>/product/mysql5.7.26/bin/mysqladmin
mysqld = <MYSQL_BASE>/product/mysql-5.7.26/bin/mysqld

socket =
<MYSQL_BASE>/admin/<MYSQL_SERVER>/socket/<MYSQL_SERVER>.sock
pid-file =
<MYSQL_BASE>/admin/<MYSQL_SERVER>/socket/<MYSQL_SERVER>.pid
log-error =
<MYSQL_BASE>/admin/<MYSQL_SERVER>/log/<MYSQL_SERVER>.err

datadir = <MYSQL_DATA>/<MYSQL_SERVER>
basedir = <MYSQL_BASE>/product/mysql-5.7.26

slow_query_log = 1
slow_query_log_file =
<MYSQL_BASE>/admin/<MYSQL_SERVER>/log/<MYSQL_SERVER>-slow-query.log

log-bin =
<MYSQL_BASE>/admin/<MYSQL_SERVER>/binlog/<MYSQL_SERVER>-bin
innodb_flush_log_at_trx_commit = 1
sync_binlog = 1
expire_logs_days = 7
local-infile = 0
log_timestamps = SYSTEM
general_log = 0
general_log_file =
<MYSQL_BASE>/admin/<MYSQL_SERVER>/log/<MYSQL_SERVER>.log
#secure-file-priv = ""
lc_messages_dir = <MYSQL_BASE>/product/mysql-5.7.26/share/
lc_messages = en_US
server_id = <STD_PORT>
#innodb_file_per_table = 1
```

:information\_source: The MariaDB 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.

:warning: **Response files has been tested for MariaDB (versions 10.2, 10.4 and 10.10). You can find different templates in DMK templates directory. Please feel free to adapt/add/remove any parameter in coherence with your MariaDB release. Several response files can coexist.**


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dbi-services.gitbook.io/dmk-mariadb-manual/servers-management/create-mariadb-servers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
