Magento 2 setup: Creating a database and users MariaDB

This guide assumes you have installed and setup MariaDB. I will be using version 10.1.40 for this guide.

Login to the SQL server

sudo mysql -u root

Add a new database and user

create database <databasename>;
create user <username> IDENTIFIED BY '<password>';
GRANT ALL ON <databasename>.* TO <username>@localhost IDENTIFIED BY '<password>';
flush privileges;

Use the command exit to quit out of the mysql interface. You can now verify the database and user.

mysql -u <username> -p
show databases;

That’s all there is to it.

The above commands and the expected system output.

This information is available in the Magento 2 dev docs for the latest comprehensive reference.

Leave a Reply

Your email address will not be published. Required fields are marked *