MariaDB is one of the most popular database server in the world. Being a community-developed fork of MySQL RDBMS, MariaDB intended to remain free under the GNU GPL license.
Why choose MariaDB over MySQL? You should see this!
Mariadb setup initial databse in /var/lib/mysql by default. If you want to manually configure your installation, go to the secure installation:
$sudomysql_secure_installation
If you have set a strong password, skip the first step.
NOTE:RUNNINGALLPARTSOFTHISSCRIPTISRECOMMENDEDFORALLMariaDBSERVERSINPRODUCTIONUSE!PLEASEREADEACHSTEPCAREFULLY!InordertologintoMariaDBtosecureit,we'll need the currentpassword for the root user. If you'vejustinstalledMariaDB,andyouhaven't set the root password yet, the password will be blank,so you should just press enter here.Enter current password for root (enter for none):OK, successfully used password, moving on...Setting the root password ensures that nobody can log into the MariaDBroot user without the proper authorisation.You already have a root password set, so you can safely answer 'n'.Change the root password? [Y/n]
Change MariaDB Data Directory and Other Configurations
MariaDB save all databases in /var/lib/mysql/ by default. If you aim to store Terabytes of data, your /var partition might get full. To avoid this, you can modifiy some MariaDB variables.
First, stop MariaDB service.
$sudoservicemysqlstop
Copy the existing data directory. Note that
$sudocp-R-p/var/lib/mysql/newpath/by/your-choice/
Edit the MariaDB configuration file
$sudovim/etc/mysql/my.cnf
Look for the entry for datadir (usually under [mysqld]). Change the path (default: /var/lib/mysql) to your new data directory.
[mysqld]
...
...
other config
...
datadir = /newpath/by/your-choice
If you need to remotely connect to database, don't bind address. Comment out following line:
#bind-address = 127.0.0.1
In addition, you can also change port for client under [client] group configuration. Default: 3306
[client]
port = 13306
Moreover, you can separate some metadata file per table for convenience. Default: 0
[mysqld]
...
...
...
other config
...
innodb_file_per_table = 1
After all the configurations, restart MariaDB server.
$sudoservicemysqlstart
Simple account management
MariaDB provide a command line tool. To enter your database on localhost, you must explicit input user and password.
$mysql-uroot-p
If you succeed, you would see this:
MariaDB [(none)]>
To create a super user that can remotely login, follow the commands in MariaDB shell:
MariaDB [(none)]> CREATE USER your_super_user@'%' IDENTIFIED BY 'your-Pa$$w0rD';
Then give all usage to the super user on all database (include create/drop other users)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO your_super_user@'%' with grant option;
Using GUI tools for daily database management will save your live from works. Here are some recommandation:
MySQL Workbench: MySQL Official GUI Tools. Provides many advanced functions.
phpMyAdmin: A Web interface tool written in PHP. Can I/O data to various formats (CSV, XML...).
HeidiSQL: A lightweith tool for database management. Has protable version. Windows only.
SQLyog Community Edition: Community edition of SQLyog MySQL administration tool.
Database Interface for Other Language
Mariadb is under GPL license. Some other language need a less strict license version to connect to MariaDB server. Hence, install LGPL version library of client-side.