MySQL is an open-source relational database. In a nutshell, for those unfamiliar with it: A database is where an application keeps its stuff.

MySQL is free and widely used, meaning you can find a lot of application support, tools, and community help for it. MySQL is a safe choice if you know you need a database but don’t know what to make of the options that are out there.

This article covers a basic installation of a MySQL server on CentOS Linux – just enough to get you started. Remember that you might need to install other packages to let apps use MySQL, like extensions for PHP. Check your application documentation for details.

The easiest way to install the MySQL server is through the CentOS package manager:

sudo yum install mysql-server
service mysqld start

To secure your MySQL Installation the easy way run this command:

sudo /usr/bin/mysql_secure_installation

Hit “enter” to give no password for root when that program asks for it. To apply some reasonable security to your new MySQL server say “yes” to all the questions the program asks. In order, those will let you set the root password, remove anonymous users, disable remote root logins, delete the test database the installer included, and then reload the privileges so your changes will take effect.

Now that MySQL is installed you can make sure it’s running by trying to launch it:

sudo service mysqld start

The following command will make sure your machine will launch the MySQL server when it reboots: