MariaDB (MySQL)
Introdução
MariaDB is the innovative open-source relational database compatible with MySQL.
Installation
How to install MariaDB.
Ubuntu
Run in the terminal:
sudo apt install mariadb-server
Windows
Download and install MariaDB:
Client
Connect to MariaDB to execute management commands on the database server.
Ubuntu
Run in terminal:
sudo mariadb
Windows
Open the Command Prompt MariaDB
app and run:
mariadb -u root -p
Or search for MySQL Client
or MariaDB Client
.
Create the Database
Run the following command while connected to the MariaDB client:
CREATE DATABASE app_db
Create User
Run the following command while connected to the MariaDB client:
CREATE USER 'app_user'@'localhost' IDENTIFIED BY 'S3cR3t';
To grant the user general access to the newly created database, run:
GRANT ALL PRIVILEGES ON app_db.* TO 'app_user'@'localhost';
Update access privileges:
FLUSH PRIVILEGES;
To exit, use the command:
\q
Configure the Application
Edit the application configuration file according to the environment:
config/_development.json
Example of database configuration for MariaDB:
{
...
"db": {
"default": {
"engine": "mariadb",
"port": "3306",
"host": "localhost",
"name": "app_db",
"username": "app_user",
"password": "S3cR3t"
}
},
...
}
Advanced settings can be used such as:
{
...
"db": {
"default": {
"engine": "mariadb",
"port": "3306",
"host": "localhost",
"name": "app_db",
"username": "app_user",
"password": "S3cR3t",
"maximumPoolSize": 100,
"minimumIdle": 1,
"idleTimeout": 10000,
"maxLifetime": 60000
}
},
...
}
See more about Database connection settings with HikariCP.