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

Follow

Comments

198 comments

  • Avatar
    Rashid Qureshi

    I have followed this Article. 

    Everything went fine but the Mysql version still shows to be 5.5?

     

    What did I do wrong?

    0
    Comment actions Permalink
  • Avatar
    Miguel Ángel (Edited )

    Hi!! :)

    After upgrade mariaDB (5.5.65 >> 10.2.34) doesn't start with mysqld_safe option :(

    Any ideas?

    Thanks!

    0
    Comment actions Permalink
  • Avatar
    Artur Beqiraj

    @Vitaly Zhidkov 

    i have specific it but dont work so does not successfully complete the installation

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    @Louis-Philippe Frenette

    Thank you for sharing the workaround.
    It may be useful to another Pleskians.

    0
    Comment actions Permalink
  • Avatar
    Artyom Baranov

    @Peter Jablonski,

    Direct upgrade of MySQL 5.1 to MySQL 5.6/5.7 will damage tables (There is the warning message at the top of this article).

    It's strongly recommended to upgrade to MySQL 5.5 at first.

    0
    Comment actions Permalink
  • Avatar
    Thomas Friedrich

    With Ubuntu 14.04 I had to restart mysql before step 7 worked.

    0
    Comment actions Permalink
  • Avatar
    Kuzma Ivanov

    Hey there Markus,

    1. Looks like not only in Bulgaria the repo http://mirror.host.ag/ is unavailable. We've already replaced it with a different one - http://mirror.truenetwork.ru.
    Thanks for bringing this to our attention.

    2. MariaDB 10.3 is not yet supported by Plesk. Support for this version will be added in the upcoming major release. It is now reflected in the article as well.

    0
    Comment actions Permalink
  • Avatar
    francesco

    What about this error? upgrading on debian 9 from mariadb 10.1 to 10.2

    Any clue how to fix it and continue upgrade?

    Removing mariadb-server-10.1 (10.1.47-0+deb9u1) ...
    (Reading database ... 97403 files and directories currently installed.)
    Preparing to unpack .../mariadb-server-10.2_10.2.36+maria~stretch_amd64.deb ...
    /var/lib/mysql: found previous version 10.1
    Unpacking mariadb-server-10.2 (10.2.36+maria~stretch) ...
    dpkg: error processing archive /var/cache/apt/archives/mariadb-server-10.2_10.2.36+maria~stretch_amd64.deb (--unpack):
    trying to overwrite '/usr/bin/mysql_install_db', which is also in package mariadb-server-core-10.1 10.1.47-0+deb9u1
    dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
    Errors were encountered while processing:
    /var/cache/apt/archives/mariadb-server-10.2_10.2.36+maria~stretch_amd64.deb
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    0
    Comment actions Permalink
  • Avatar
    Vinod Vyas

    I am upgrading MariaDB 5.5 to v10.3

    What is the command to FIND if any additional packages like mariadb-bench are installed.

     

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello,

    Mark S. 10.5 should also work fine. The article author will double-check it and add corresponding instructions.

    Learning Curve Thank you for the feedback. These points will be also reviewed and we'll look at how to improve the article.

    0
    Comment actions Permalink
  • Avatar
    Nerque

    Since message approval takes a long time, I tried to perform the actions I listed above, and some recommended from other sites, by uninstalling mariadb 5.5, just in case.

    ------------------------------------------------------

    mysqldump -u admin -p`cat /etc/psa/.psa.shadow` --all-databases --routines --triggers > ~/backup/all-databases.sql

    for DB in $(mysql -uadmin -p`cat /etc/psa/.psa.shadow` -B -e "show databases" -s --skip-column-names); do
        mysqldump -u admin -p`cat /etc/psa/.psa.shadow` $DB > ~/backup/$DB.sql
    done

     

    mysql -uadmin -p`cat /etc/psa/.psa.shadow` -B -e "SET GLOBAL innodb_fast_shutdown=0;"

    systemctl stop monit.service

    systemctl disable mariadb

    systemctl stop mariadb

    cp -v -a /var/lib/mysql/ /var/lib/mysql_backup

    cp /etc/my.cnf ~/backup/

    cp -v -a /etc/my.cnf.d/ ~/backup/

    rpm -e --nodeps `rpm -q --whatprovides mariadb-server`

     

    vi /etc/yum.repos.d/MariaDB.repo

    [mariadb]

    name = MariaDB

    baseurl = http://yum.mariadb.org/10.3/centos7-amd64

    gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

    gpgcheck=1

     

    yum install MariaDB-server MariaDB-client MariaDB-shared MariaDB-backup MariaDB-common

    systemctl enable mariadb

    systemctl restart mariadb

    mysql_upgrade -uadmin -p`cat /etc/psa/.psa.shadow`

    systemctl restart mariadb

    plesk sbin packagemng -sdf

    mysql -uadmin -p`cat /etc/psa/.psa.shadow` -B -e "SELECT VERSION();"

    systemctl restart monit.service

    ------------------------------------------------------

     

    And... apparently, everything's fine. All the websites are working as before... Good.

     

     

    0
    Comment actions Permalink
  • Avatar
    Artyom Baranov

    @Richard Mountain,

    Hello! Please provide me with the output of the following commands:

    # plesk version

    # mysql -V
    0
    Comment actions Permalink
  • Avatar
    Nerque

    First of all, thanks for the answer.

    If it is not necessary to uninstall the current version of MariaDB (5.5), could I update MariaDB, instead of uninstalling the old version and installing the new one(10.3)?

    I understood from some site that it was not recommended, and that it was better to uninstall version 5.5 and then install version 10.3. I don't know if that's true.

    If an upgrade were possible, I suppose the steps would be:

    -------------------------------------------------

    MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -u admin --all-databases --routines --triggers > /tmp/all-databases.sql

    service mariadb stop

    cp -v -a /var/lib/mysql/ /var/lib/mysql_backup

     

    vi /etc/yum.repos.d/MariaDB.repo

    [mariadb]

    name = MariaDB

    baseurl = http://yum.mariadb.org/10.3/centos7-amd64

    gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

    gpgcheck=1

     

    yum -y upgrade maria*

    systemctl restart mariadb

    MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql_upgrade -uadmin

    systemctl restart mariadb

    plesk sbin packagemng -sdf

    -----------------------------------------

    Is this all right?

     

    And, although a copy of the databases is made, with the dump and copy of the mysql folder, I am not very clear about the process to recover it in case of disaster. Uninstall MariaDB 10.3, remove the repo file, reinstall the default version of centos, restore mysql folder and then recover the dump? Would this be the right order? Is it necessary to restore the mysql folder or is it enough to recover the dump?

     

    Thank you in advance

     

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello Necro

    > What is " 'mysql' init script"

    This is a leftover from previously installed MySQL server. Init script is a script for a service to start on boot.

    > Should i run those final steps anyway?

    The last step is required to make sure the processes of old MySQL version are stopped, to start MariaDB if not started, and to make sure that MariaDB will start after the server reboot. I would recommend not avoiding it.

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello @Jeremy,

    Thank you for sharing your user experience.

    For further issues feel free to contact Plesk Technical Support.

    0
    Comment actions Permalink
  • Avatar
    Alexandr Tumanov

    @Learning Curve, great!

    0
    Comment actions Permalink
  • Avatar
    Kingsley Felix (Edited )

    the commands for debian 9 is FAILING, NOT FOUND ERROR.

     

    # curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=mariadb-10.3
    -bash: sudo: command not found
    curl: (23) Failed writing body (360 != 1369)

    0
    Comment actions Permalink
  • Avatar
    Michael Zagaris

    Hello, just upgraded my MariaDB from 5.5 to 10.3 on Plesk Obsidia 18.0.21 and it worked just great..Took me 5 minutes and all websites are working just fine and i believe faster. I upgraded because i believe that 5.5 was causing some freezes on some queries that included SELECT DISTINCT..That happened a lot of times lately, so i hope this gets fixed..i believe it was about Copying tmp tables, or Waiting for table lock isues

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    @Alexander, thank you for letting us know your experience!

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello @Cogeco Peer 1 Frontline,

    I have reviewed the article, "mysql_upgrade" is already added to be executed after upgrading Database server and starting it.

     

    0
    Comment actions Permalink
  • Avatar
    Louis-Philippe Frenette

    For those like me who installed mysql from the webtatic repo here's the workaround to upgrade to 5.6 or 5.7 on Centos 6:

     

    instead of 

    # yum update mysql

    write the following:

    # yum replace mysql55w --replace-with=mysql-community-client mysql55w-libs --replace-with=mysql-community-libs mysql55w-server --replace-with=mysql-community-server

     

    0
    Comment actions Permalink
  • Avatar
    Steve Yates

    Hi Julian, finally got around to installing updates.  Updated 3 Plesk servers tonight that had MariaDB 10.2.  One did not have /etc/init.d/mysql, but the other two did, both files dated June 14.  One of those had MariaDB 10.2.24 installed June 21, the other on June 19.  I updated all (yum update) and none of the three had file /etc/init.d/mysql afterwards.  Maybe MariaDB changed/fixed the update, who knows.  I'll let it go for now and maybe open a ticket if it ever recurs.

    0
    Comment actions Permalink
  • Avatar
    Alexander Hammer

    Dear Ivan, I can answer my own question. When checking the status of the MariaDB service, there where an error message regarding the innodb table(s). After I ran "mysql_upgrade" command the error was gone.

    0
    Comment actions Permalink
  • Avatar
    Md Rasel Khan (Edited )

    Thanks!

    The automatic method worked fine except Email sending & receiving due to a MariaDB bug #MDEV-24941: SElinux incorrect label for server socket.

    Although there is a solution for this here https://support.plesk.com/hc/en-us/articles/360017337699

    My system is Plesk Obsidian Version 18.0.35 CentOS 7.9 on Lightsail.

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello SamParis

    Thank you for noticing.

    According to https://jira.mariadb.org/browse/MDEV-14367 this happens when updating from MariaDB 10.1.

    However, this still may be useful for other Pleskians.

    0
    Comment actions Permalink
  • Avatar
    Dr. Michael Gellner

    Sorry - this becomes annoying.

    Plesk writes that Moodle is a supported application - but today even a fresh install on a fresh system (Ubutu 18.04) is impossible. Again the famous non zero exit.

    Again the mariaDB version is too old. That's why at the beginning of the week my former debian server became unusable for moodle. Since days I try and try THESE linux hacking rubbish that don't want to apply. Now I sit in front of my fresh Ubuntu system with the same missing Moodle in these remote corona days and waste day after day with this mariaDB shit! 

    Please: ONE BUTTON, ONE UPDATE as it should be for Plesk users! Six pages reading tricks with endless links to source of sources to sources - sorry, NO!

    If Plesk supports Moodle I expect a real Plesk update without this not working hacks. Otherwise remove Moodle from the compatibility list. At the moment it neither be used nor installed. And that's the last thing I (and I guess a lot of others either) can need in these distancing days. Sorry for being a little harsh, but working help is needed urgently. And no: this is nothing for an additional purchasing of any Service. If the DB update will do as it should we would be done.

    Thanks 

    0
    Comment actions Permalink
  • Avatar
    Stefan

    Thank you for the guide, I sucessfully updated mysql 5.1 to mysql 5.6 on centos 6 with plesk 17.5.3.

    Now, how do I upgrade / replace this mysql 5.6 to maria db 10.1?

    0
    Comment actions Permalink
  • Avatar
    Bruno Schrotter

    Thanks @Alexandr Redikultsev!
    I very much appreciate your kind response and suggestion.

    0
    Comment actions Permalink
  • Avatar
    Artur Beqiraj

    i have centos 7 end plesk Onyx end i need to have mariaDB 10.0.27 is possible ?

    Is there any way to get this version?

    thanks

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello Dr. Michael Gellner

    Sorry for the long response and thank you for the feedback.

    To be honest, on your side I would feel the same.

    However, the only way to satisfy the requirements is to do the steps from this article manually.

    Usually, the process goes smoothly.

    If now you're stuck with some particular error, let us know, maybe some Pleskian already has a solution.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request