Installation & Configuration of MySQL in CentOs

MySQL and MariaDB is the most popular database management system and is well known for its stability, flexibility, robust and powerful nature. Installing MySQL is a very simple process and it involves only a couple of steps. This tutorial covers how MySQL is installed and configured in a CentOS server.

Steps involved:

Step 1) Install MySQL and start MySQL service

Step 2) Create directory structures and management system tables for MySQL

Step 3) Reset MySQL root password

Let’s see how this can be done.

Install MySQL and start MySQL service

You can install MySQL simply with yum.

yum install mysql-server

If you give permission to proceed by answering ‘Y‘ to the questions asked while installation, MySQL server will be installed. We need to start the MySQL service manually as it will not start automatically after installation.

service mysqld start

Now MySQL server is UP and running. We can move on to Step 2.

Create directory structures and management system tables for MySQL

For this, you just need to run the command:


You may refer the screenshot below.

Reset MySQL root password

After installing MySQL system tables, you need to set the MySQL root password since MySQL password is not set by default. This can be done by the command:


This will prompt current MySQL root password and by default password is not set for root MySQL user, so just hit ‘Enter’ and proceed with setting the root password by pressing ‘Y‘ for the confirmation question. Enter the new password twice when asked. Don’t forget to hit ‘Enter’ each time you enter the password.

Take a look at the screenshot below.


Then for configuring the MySQL server just press ‘Y’ for all the questions asked as it is the recommended setting. Here is the screenshot of how to proceed.

You’ve a new, secured MySQL installation ready to serve your applications 🙂

Leave a Reply

Your email address will not be published.