Knowledgebase

 How to upgrade MySQL 5.5 to 5.6/5.7 or MariaDB 5.5 to 10.x on Linux?

Upgrading MySQL 5.5 to 5.6/5.7 or MariaDB 5.5 to 10. x on Linux involves several steps to ensure a smooth transition. Below are the general steps you should follow. Please note that the specific commands may vary based on your Linux distribution.

Important: Before starting, it's crucial to back up your databases and configurations to avoid data loss in case of any unexpected issues during the upgrade process.

Upgrade MySQL:

  1. Backup Databases:

    • Use mysqldump to create backups of all your databases.
    bash
    mysqldump -u root -p --all-databases > all_databases.sql
  2. Remove the Old MySQL Version:

    • Depending on your Linux distribution, you may need to use different package management commands. For example, on Ubuntu:
    bash
    sudo apt-get remove mysql-server
    • This will uninstall MySQL 5.5.
  3. Install MySQL 5.6/5.7:

    • Install the desired MySQL version. Again, the command may vary depending on your distribution:
    bash
    sudo apt-get install mysql-server-5.6
  4. Run MySQL Upgrade Script:

    • After installation, there might be an upgrade script available. It's recommended to run it:
    bash
    sudo mysql_upgrade -u root -p
  5. Check MySQL Version:

    • Verify that MySQL has been upgraded to the desired version:
    bash
    mysql -u root -p -e "SELECT version()"

Upgrade MariaDB:

  1. Backup Databases:

    • As before, create backups of your databases using mysqldump.
  2. Remove the Old MariaDB Version:

    • Again, depending on your Linux distribution:
    bash
    sudo apt-get remove mariadb-server
  3. Add MariaDB Repository (if needed):

    • For upgrading to MariaDB 10.x, you might need to add the MariaDB repository and key:
    bash
    sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://mirror.centos.org/centos/7/updates/x86_64/Packages/mariadb-10.2.7/centos73-mariadb.repo' sudo apt-get update
  4. Install MariaDB 10.x:

    bash
    sudo apt-get install mariadb-server
  5. Run MariaDB Upgrade Script:

    bash
    sudo mysql_upgrade -u root -p
  6. Check MariaDB Version:

    bash
    mysql -u root -p -e "SELECT version()"

Additional Steps:

  1. Reconfigure Databases (if needed):

    • Depending on your specific configurations, you may need to adjust settings in the new version.
  2. Restart MySQL/MariaDB:

    bash
    sudo systemctl restart mysql
  3. Verify Services:

    bash
    sudo systemctl status mysql
  4. Check Databases:

    • Log in to MySQL/MariaDB and ensure that your databases and data are intact.

Please note that the exact steps may vary depending on your Linux distribution and package manager. Always refer to the official documentation for your specific OS to ensure a successful upgrade.

  • 0 Users Found This Useful
Was this answer helpful?