Installing MySQL On CentOS 8

The database in a server is essential for the execution of a dynamic website to be used as a medium to store its data. Usually, on old Linux versions, we install MySQL as our default database server but recently most Linux distros have migrated to the MariaDB database server.

Install MySQL

Step 1 : Update your system

sudo yum update

Step 2 : To install MySQL, use the following

sudo yum install mariadb-server mariadb

Step 3 : Start, enable check the service and enable MySQL.

sudo systemctl start mariadb
sudo systemctl enable mariadb.service
sudo systemctl status mariadb

Configure Security

Step 1 : we need to use the MariaDB secure installation command. This command is very useful to customize the level of security of the database server with a variety of options

sudo mysql_secure_installation

  • Enter for none
  • Set root password
  • Remove anonymous users
  • Disallow root login remotely
  • Remove test database and access to it

Test MySQL

When done, test access using the root user

mysql -u root -p

We type the password already set during the secure installation and we will have the MariaDB CLI.

To quit it just type exit.

Add Comment