Create MySQL database

The ability to create a database in MySQL requires that the user account have elevated permissions to the server. Not only that, the machine that the user is using needs to be specified to their account (unless using %). This can make permissions somewhat unruly to manage. Using a runbook, you can create the database without altering permissions by executing it on the server itself or an approved worker.

In the following example, we’ll use the MySQL - Create Database If Not Exists community step template.

Create the runbook

  1. To create a runbook, navigate to Project ➜ Operations ➜ Runbooks ➜ Add Runbook.
  2. Give the Runbook a name and click SAVE.
  3. Click DEFINE YOUR RUNBOOK PROCESS, then click ADD STEP.
  4. Add a new step template from the community library called MySQL - Create Database If Not Exists.
  5. Fill out all the parameters in the step. It’s best practice to use variables rather than entering the values directly in the step parameters:
ParameterDescriptionExample
ServerName or IP of the MySQL serverMySQL1
UsernameUsername with rights to create a databaseroot
PasswordPassword for the user accountMyGreatPassword!
Database NameName of the database to createMyDatabase
PortPort number for the MySQL server3306
Use SSLWhether to use the SSL protocolChecked for True, unchecked for False

This will create a database without having to grant any additional permissions to the server.

Help us continuously improve

Please let us know if you have any feedback about this page.

Send feedback

Page updated on Wednesday, October 4, 2023