Install and configure Mariadb server on Centos 6/7 and Fedora 27/28

0
548

MariaDB is an software  replacement for MySQL and is an open source fork of MySQL created by the original MySQL creators. As of Red Hat Enterprise Linux (RHEL7) and CentOS 7 MariaDB is now the default SQL database, rather than MySQL which was the default in previous releases of the operating system.
Here we’re going to cover how to install and configure MariaDB server.
Sinds 2015 is  MariaDB becoming standard Mysql software for many linux  distributions and can be easy  installed via repositories  ( Yum/Apt/Packman/Zypper/….. .)

How  to install  Mariadb server and  Client

MariaDB is simply installed with ‘yum’ as shown below. This is recommended over compiling from source or using RPM files, as MariaDB will be easier to update in the future through the package manager via ‘yum update’.

Install and configure Mariadb server

Please note:  i have tested  these tutoarial under my Centos7.4

How  to install  Mariadb server and  Client

MariaDB should now be installed, we can confirm the package version installed as shown below.

Configuring MariaDB

By default after installation MariaDB will not be running and will not start on boot as shown below. you can fix tha twith the bellow commands.

Check if  MariaDB running and Listening

check process

Port  listening

Setup root  mariadb password

Now that MariaDB is running you can access the command line by simply running ‘mysql’ as there is not yet any password in place, to setup  the root password please use  the command   ‘mysql_secure_installation’

Test you access and see the created databases

How to Create  Database 

Create database osradardb

Create  database user osradaruser identified  with password  AAA123

Grant all privileges to a user (osradaruser) on a specific database ( example osradardb)

Because of security we are using  localhost  instead of ‘%’ (  manage database remotely)

Apply changes made

To be effective the new assigned permissions you must finish with the following command: and exit

Please Check if  the new user  able to  login and see the database

Its Empty database: How to import an dump  database to this one?

for example your export dump  named  dump.sql  located under /root

to import  this exported database to your empty  database, please do the following

Now you can login again and see the tables  and the columns.

I found  on internet this bash script that can help you easy to crease user,database and grant  the permissions  :

Don’t forget  chmod +x and run it under root user

Thank you for reading

Spread the love
  • 11
    Shares

PS. If you like this post please share it with your friends on the social networks using the buttons above.Thanks.

LEAVE A REPLY

Please enter your comment!
Please enter your name here