Install MySQL 5.6 on Fedora 22/21, CentOS/RHEL 7.1/6.6/5.11

MySQL Logo

Are you looking MariaDB 5.5/10.0 Install guide?

MySQL is a relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases. This is guide, howto install or upgrade MySQL Community Server latest version 5.6 (currently 5.6.25) on Fedora 22/21/20, CentOS 7.1/6.6/5.11 and Red Hat (RHEL) 7.1/6.6/5.11. This guide works of course with Oracle Linux and Scientific Linux too and MySQL 5.7 development version installation is possible too.

Note: If you are upgrading MySQL (from earlier version), then make sure that you backup (dump and copy) your database and configs. And remember run mysql_upgrade command.

Install MySQL Database 5.6.25 on Fedora 22/21/20, CentOS 7.1/6.6/5.11, Red Hat (RHEL) 7.1/6.6/5.11

1. Change root user

2. Install MySQL YUM repository


CentOS and Red Hat (RHEL)

3. Update or Install MySQL 5.6.25

Fedora 22

Fedora 21/20, CentOS 7.1/6.6/5.11 and Red Hat (RHEL) 7.1/6.6/5.11

4. Start MySQL server and autostart MySQL on boot

Fedora 22/21/20 and CentOS 7.1

CentOS 6.6/5.11 and Red Hat (RHEL) 6.6/5.11

6. MySQL Secure Installation

  • Set (Change) root password
  • Remove anonymous users
  • Disallow root login remotely
  • Remove test database and access to it
  • Reload privilege tables

Start MySQL Secure Installation with following command


Note: If you don’t want some reason, do a “MySQL Secure Installation” then at least it’s very important to change the root user’s password

7. Connect to MySQL database (localhost) with password

8. Create Database, Create MySQL User and Enable Remote Connections to MySQL Database

This example uses following parameters:

  • DB_NAME = webdb
  • USER_NAME = webdb_user
  • PASSWORD = password123

Enable Remote Connection to MariaDB Server –> Open MySQL Port (3306) on Iptables Firewall (as root user again)

1. Fedora 22/21/20 and CentOS/Red Hat (RHEL) 7.1

1.1 Add New Rule to Firewalld

1.2 Restart firewalld.service

2. CentOS/Red Hat (RHEL) 6.6/5.11

2.1 Edit /etc/sysconfig/iptables file:

2.2 Add following INPUT rule:

2.3 Restart Iptables Firewall:

3. Test remote connection

Share this post


  1. Good Solution~~~ Thank you….

  2. can u solve this error
    [root@localhost Desktop]# service mysql start
    Starting MySQL………………………………………………………………… SUCCESS!
    [root@localhost Desktop]# mysqladmin -u root password pinkuupadhyay
    mysqladmin: connect to server at ‘localhost’ failed
    error: ‘Access denied for user ‘root’@’localhost’ (using password: NO)’
    [root@localhost Desktop]# mysql -u root -p
    Enter password:
    ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)
    [root@localhost Desktop]# mysql -u root -p
    Enter password:
    ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
    [root@localhost Desktop]# mysql -h localhost -u root -p
    Enter password:
    ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
    [root@localhost Desktop]#

    • Hi shaurabh,

      So what password you used on last two attempts?

  3. Thank you for this tutorial. Did this installation many times already, but it is always good to have a tutorial like this that can be followed.

  4. It worked like a charm! :D Thank you VERY much!

    Bye from

  5. I followed the instructions and have according to that I have MySQL 5.5.36 server installed, however the client still shows up as 5.1.73 inside phpMyAdmin. phpMyAdmin gives me a warning message:

    Your PHP MySQL library version 5.1.73 differs from your MySQL server version 5.5.36. This may cause unpredictable behavior.

    How can I fix that? Please someone give me a solution. Thank you!

    • Hi Martin,

      Could you post output of following command:

  6. Hi JR,

    Here is what I get.

    # rpm -qa mysql\*

  7. Hello,

    I have successfully installed MySQL, but it starts together with the system (as specified in the tutorial). Now, two short questions:

    1. to disable autostart on boot should I enter this under root?

    “systemctl disable mysqld.service”

    2, And how terrible is it (systemwise) to close the computer with mysql server running?

    • Hello Vasile,

      1. Yes, you can disable mysql service it using that command as root.

      2. Do you mean close computer using “poweroff command”? Or close computer using “power switch”?



  1. Install MySQL 5.1 (5.1.49) on Fedora 13, CentOS 5.5, Red Hat (RHEL … | mysql - [...] artykuÅ‚: Install MySQL 5.1 (5.1.49) on Fedora 13, CentOS 5.5, Red Hat (RHEL … a-server-providing, fedora, greatest-version, …
  2. Creando una base de datos en MySQL para conectar con Haskell | Sólo para Mí! - [...] rows affected (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) Fuente: [...]

Submit a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">