
How to manually create a new MySQL / MariaDB Database
Before you install your self-hosted MIDAS scheduling system, you will need to create a empty MySQL or MariaDB database on your server.This article outlines how to manually create a database from the command line.
If your server runs cPanel, follow our How to create a database in cPanel instead, otherwise carry on reading...
Note: Text in red below denotes details you may need to modify for your particular server setup.
Step 1: Login to your database server
From your server's command line, login to your MySQL or MariaDB server by executing the following command:$ mysql -u root
NOTE: If you're running MySQL on a Windows machine, you can skip this step and access the MySQL command line via the "MySQL Command Line Client" shortcut in your Start Menu → Programs → MySQL folder instead.
Step 2: Create a Database
Enter a desired name for your MIDAS database:mysql> CREATE DATABASE `MIDAS`;
NOTE: You will need the name of this database when installing MIDAS - also, please note that SQL queries outlined here may contain "backtick" characters ( `
) which are not the same as regular apostrophes ( '
).
Step 3: Create a datbase user
Once you've created a database, create a new database user:mysql> CREATE USER `username`@`localhost` IDENTIFIED BY 'password';
NOTE: You will need this username/password when installing MIDAS
If your database and web servers reside on different physical hardware to each other, you will need to substitute localhost
in the above code to reflect the IP/domain of your web server.
If unsure of your web server's IP/domain, you can instead substitute `localhost
` for `%
`. This will allow the database server to accept incoming connections from any host. However for security this approach is not recommended, and you should always endeavor to use localhost
or the exact IP/domain name of your web server instead.
Step 4: Assign the user to the database & set user privileges
Once you've created a database and a database user, you will need to associate the user with that database and grant the necessary privileges:mysql> GRANT ALTER, CREATE, DELETE, DROP, INSERT, LOCK TABLES, SELECT, UPDATE ON `MIDAS`.* TO `username`@`localhost`;
Step 5: Flush Privileges
Finally, to ensure that the privileges you set in the previous step are applied, issue the following command:mysql> FLUSH PRIVILEGES;
Once you've set up your database, you're ready to install MIDAS
← Return to the Knowledge Base