Home > Database, Linux > Install mySQL on CentOS Linux

Install mySQL on CentOS Linux

Installing mysql on CentOS, is easy, as 1,2,3. Though i wouldnt say this will be as easy as windows’s installation.

In this short tutorial i will explain how to do it, via console, as most servers dont have GUI installed. And preassumeably, you are login as root and have active internet connection.

  • Get installation package: to get mysql installation package easy (CentOS has yum repository manager). Just type yum install mysql-server on your CentOS’s console.



Type y, and let Yum do its job, until below screen appear.


  • Make sure mysql is started by typing /etc/init.d/mysql start


  • run mysql_secure_installation to set credential and security for your mysql, and enter your current root password, you can leave it blank because we havent set it up yet. And follow instructions on the screen.

    • Set root password? [Y/n]: fill with Y if you want to set root password for your mysql. Root password is the top level access for your mysql, so be wise in use it. And dont forget the password.
    • Remove anonymous users? [Y/n]: By default, mysql has anonymous user account that can be used by anyone to log into mysql without having user account. Remove anonymous user in production, meanwhile in development is up to you.
    • Disallow root login remotely? [Y/n]: If you want root can be accessed from remote computer, you have to set it with n. By allowing root login remotely, your root account can be accessed from any computer that connected with your mysql machine.
    • Remove test database and access to it [Y/n]: By default, mysql has database named ‘test’ that used only for testing purpose. You can remove it safely because it has no effect to your mysql system.
    • Reload privilege tables now? [Y/n]: Fill with Y if you want to reload your privilege that had been set up immediately.

  • run mysql_install_db to adjust your mysql system tables.

mysql centos 07 Mar. 11 15

  • Setting CentOS firewall. After your mysql has been installed on your machine, now the last step you have to do is giving firewall privilege to your mysql port, so it can be accessed from remote machine. Of course you have to do it, because in many cases i believe you wont access your mysql directly from your machine. To do this, on your CentOS Console, type setup and you will have below screen.

mysql centos 09 Mar. 11 15


Choose Firewall configuration and Run Tool to get into Firewall configuration window.

mysql centos 10 Mar. 11 16

Choose Customize, and fill Other ports with 3306 (default mysql port). And press OK.mysql centos 11 Mar. 11 16

Voila, your mysql has been set up, and please let me know if you have any problem installing it.

Categories: Database, Linux Tags: ,
  1. Min Thu Hein
    15 June 2013 at 00:31

    After I run mysql_secure_installation, it requests to type root password. There is no password that I already typed. So, I typed ‘Enter’ key. But it requests to type password again and again. If you have any suggestion, please let me know.

    • RDeJourney
      15 June 2013 at 00:57

      try ‘root’ or ‘administrator’ ?

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: