How to install MariaDB on CentOS 7/6.5/5.10

Sean78Black

Member
Joined
May 29, 2016
Messages
84
Points
8
These steps will guide you install MariaDB on CentOS 7/6.5/5.10

1. Adding MariaDB repo

Note: No need to take on CentOS 7. MariaDB on CentOS version 7 is 5.5.37

Code:
## CentOS 6/5 MariaDB 5.5 ##
wget -O /etc/yum.repos.d/MariaDB.repo http://mariadb.if-not-true-then-false.com/centos/$(rpm -E %centos)/$(uname -i)/5

## CentOS 6/5 MariaDB 10.0 ##
wget -O /etc/yum.repos.d/MariaDB.repo http://mariadb.if-not-true-then-false.com/centos/$(rpm -E %centos)/$(uname -i)/10
2. Install or update MariaDB

Code:
## CentOS 7 ##
yum install -y mariadb mariadb-server

## CentOS 6.5/5.10 ##
yum install -y MariaDB MariaDB-server
3. Restart MariaDB và auto run when boot

Code:
## CentOS 7 ##
systemctl start mariadb.service
systemctl enable mariadb.service

## CentOS 6.5/5.10 ##
service mysql start
chkconfig --levels 235 mysql on
4. Configure MariaDB

  • Set (Change) root password
  • Remove anonymous users
  • Disallow root login remotely
  • Remove test database and access to it
  • Reload privilege tables

– Start the installation

Code:
/usr/bin/mysql_secure_installation
At the first step you will be asked for the user password, because of the new installation will not have the password, so press Enter to continue.

– Output as following:

Code:
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we\'ll need the current
password for the root user. If you\'ve just installed MariaDB, and
you haven\'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 MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
... Success!

Normally, root should only be allowed to connect from \'localhost\'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
... Success!

By default, MariaDB comes with a database named \'test\' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
... Success!

Cleaning up...

All done! If you\'ve completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
Good luck!
 

anhbloginc

Member
Joined
Jun 24, 2015
Messages
101
Points
18
That's a good guide to learn how to install MariaDB on CentOS. You should write another post to tell users know how to install Nginx and configure it.
 
Older threads
Replies
9
Views
3,378
Replies
0
Views
2,534
SIG
Replies
8
Views
3,818
Replies
3
Views
3,168
Newer threads
Replies
8
Views
4,632
Replies
0
Views
5,284
Latest threads
Replies
1
Views
36
Replies
0
Views
44
Replies
0
Views
41
Replies
1
Views
56
Replies
3
Views
126
Recommended threads

Latest postsNew threads

Referral contests

Referral link for :

Sponsors

Popular tags

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top