SystemMen - In this article, I will show you how to install MariaDB 10.2 on CentOS 6.
Here are the minimum requirements for the server, I have used a virtual server with such requirements.
- OS: CentOS 6.9 (Final) 64 bit
- RAM: minimum 1GB memory
- HDD: over 5GB free space. Maybe you need more for store databases
- User: root
- IP: set static ip, ex: 192.168.56.3
Added MariaDB repository
The first step is to add MariaDB repository to CentOS 6 server.
You can find more information on how to add a repository here.
Please copy and paste the code below into your terminal. Note that there are no spaces at the beginning of the lines between EOF characters
cat > /etc/yum.repos.d/MariaDB.repo <<"EOF" # MariaDB 10.2 CentOS repository list - created 2018-03-28 06:30 UTC # http://downloads.mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.2/centos6-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 EOF
After adding the repository, you type below command to update new packages from MariaDB repository.
yum update -y
Install MariaDB in CentOS 6
To install MariaDB server on CentOS 6, type the following command.
yum install MariaDB-server MariaDB-client -y
You wait a while for the installation to complete. Then, type the following two commands to enable the service when you reboot and start the service.
chkconfig mysql on service mysql start
You can then type the following command to check the mysql service status.
service mysql status
And you need to set up the initial security for the MariaDB server using the following command. You will answer some basic questions, set the root password (if not set).
Set rules in IPtables
If you only use MariaDB for the local host, you can skip this section.
If you want to open mysql port 3306 for other servers that can connect to and use the database, then type the following commands.
iptables -I INPUT 1 -m tcp -p tcp --dport 3306 -j ACCEPT iptables-save > /etc/sysconfig/iptables
And to check the status of the IPtables rule table, you type the command below.
Check MariaDB run
Now on the terminal window, type the following command to login to the mysql service. Remember to type the root password you set.
mysql -u root -p
If your logint succeeds as shown in the image above, you have successfully installed MariaDB 10.2 on CentOS 6. And now you can use the database server.If you liked this article, then please subscribe to our YouTube Channel for more video tutorials. You can also find us on Twitter and Facebook.
If you appreciate what we share in this blog, you can support us by:
- Stay connected to: Facebook | Twitter | Google Plus | YouTube
- Subscribe email to recieve new posts from us: Sign up now.
- Start your own blog with SSD VPS - Free Let's Encrypt SSL ($2.5/month).
- Become a Supporter - Make a contribution via PayPal.
- Support us by purchasing Ribbon Lite Child theme being using on this website.
We are thankful for your support.