Install MySQL on CentOS 7.5

29/12/2020
In this tutorial I will show you how to install MySQL Database on CentOS 7.5 operating system using the yum commands and the built in utilities of CentOS. It can be installed from source, or additional ways, but we will do it using CentOS native commands.

Firstly let’s make sure to update our system before starting in case of any out of date dependencies.

[root@centos7-linuxhint ~]# yum update

There are numerous packages available on CentOS related to MySQL without having to add the EPEL extra package repository. To see a list of them all try this command for yum search:

[root@centos7-linuxhint ~]# yum search mysql

Looking down the list, you can see there is no option for mysql, itself, just various related packages. The reason is that Oracle purchased MySQL when they bought Sun Microsystems, and the founders of MySQL restarted the pure open source initiative with a new name called mariadb, but its still basically MySQL but fully open source.

So lets install mariadb package.

Installing Mariadb Server

Run the yum install command for mariadb as such:

[root@centos7-linuxhint ~]# yum install mariadb
[root@centos7-linuxhint ~]# yum install mariadb-server

Run the following command to check which files were actually installed:

[root@centos7-linuxhint ~]# rpm -ql mariadb
[root@centos7-linuxhint ~]# rpm -ql mariadb-server

Using the MariaDB Service Controller

MySQL and MariaDB come with native utilities to initialize a database as well as starting and stopping a database. mysql_install_db and mysqladmin are two primary utilities. However given we are focused on the CentOS linux distribution lets look at the service file that comes with the RPM files and can be used for a native CentOS experience.

The service comes in a script file and also can be run with typical commands such as the following:

[root@centos7-linuxhint ~]# ls -lart /usr/lib/systemd/system/mariadb.service
[root@centos7-linuxhint ~]# service mariadb status

You can now start the mariadb service with the service script as shown:

[root@centos7-linuxhint ~]# service mariadb start

To verify the service is running lets connect to the DB with the mysql command line utility and run some basic commands once we are connected:

[root@centos7-linuxhint ~]# mysql

Conclusion

That’s all it takes to get started installing MySQL and using it on CentOS, but of course to be an advanced user you will want to learn a lot more. For more info check the links below:

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

MySQL GUI Tools for Ubuntu 18.04

In this lesson, we will look at some most popular GUI tools to access MySQL database on Ubuntu 18.04. These vary in application...
29/12/2020

Install phpMyAdmin on Ubuntu 18.04

phpMyAdmin is a very useful web-based database management tool to manage MySQL or MariaDB databases. It is a free tool...
29/12/2020

How to install MySql on Ubuntu

What is Mysql? MySQL is a widely accessible open source Relational Database Management System (RDBMS) that uses Structured...
28/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Dịch vụ thuê mua proxy giá rẻ an toàn, tốc độ cao
13/05/2024

Thuê mua proxy V6 uy tín, chất lượng tại đâu?
11/05/2024

Thuê mua proxy Tiktok tăng doanh thu, hiệu quả cao
11/05/2024

Thuê mua proxy xoay ở đâu uy tín, chất lượng, giá tốt?
11/05/2024

Thuê mua proxy game nâng cao trải nghiệm trò chơi
10/05/2024