How to upgrade MySQL 5.5 to 5.6/5.7 or MariaDB 5.5 to 10.0/10.1/10.2 on Linux?

Follow

Comments

106 comments

  • Avatar
    Jan Bludau

    I would like to give a advise / complete the guide.

    if you have Watchdog configured to monitor mysql, it could happen that it will automatically try to start the server for example while copying cp -a the mariadb /data-folder/ ... then it woudn't succed. And i would recommend to disable watchdog monitoring while try to upgrade mysql / mariadb... it could cause errors...

    0
    Comment actions Permalink
  • Avatar
    Dinara Aspembitova

    Hello @Jan Bludau,

    Thank you for the notice.

    The article has been updated.

    1
    Comment actions Permalink
  • Avatar
    Jan Bludau

    Hello @Dinara Aspembitova,

    Cool, very fast :-)

    0
    Comment actions Permalink
  • Avatar
    WeHoDo

    Hi, im quite new on Plesk.
    I have an VPS with Centos 7 installed with Plesk.
    SQL 5.5.60 is running.

    Is there an option to upgrade from Plesk gui?

    1
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello @WeHoDo,

    There is no such functionality, please, follow the steps from this article.

    In case you want it to be done from Plesk side, submit a request to Plesk Professional Services: https://www.plesk.com/professional-services/administrative-services/

    1
    Comment actions Permalink
  • Avatar
    WeHoDo

    @Ivan,

     

    Thank you for your quick reply.
    I will have a look.

    0
    Comment actions Permalink
  • Avatar
    Jan Bludau

    @Ivan: the mysql-upgrade guide is complette, everythink worked as aspected :-)

    to be more update2date is quite nice, more performance is also quite nice =D

    on the plesk gui for install i see that i could install a "MySQL Server" why you don't support updating it?

    the guide works as aspected, fully automatical, without a user input. You give an notice that you will do an backup and everything is cool :-)

    without exakt that line: "rpm -e --nodeps `rpm -q --whatprovides mysql-server`" you will destroy the plesk installation *smile*

    0
    Comment actions Permalink
  • Avatar
    Alisa Kasyanova

    @Jan Bludau
    Glad to know that this guide helped! You are right that it is necessary to use all the mentioned steps, or the upgrade could go wrong.
    >>> on the plesk gui for install i see that i could install a "MySQL Server" why you don't support updating it?
    The implementation of such automatic update is quite difficult, since every step should be done very attentively, and each step should be checked thoroughly. So as for now, such upgrades should be performed manually.

    1
    Comment actions Permalink
  • Avatar
    WeHoDo (Edited )

    Hi,

    I have tried to run the commands on Centos 7 on a test VPS.
    I get no errors, but in the GUI it stills show 5.5.60 as database server version.

    In the CLI I see this:
    mysql Ver 15.1 Distrib 10.2.23-MariaDB,

     

    Did I missed something?

     

    ==

    Never mind, now its shows the 10.2.23 version.
    Probaly some updates didnt renew directly.

     

    Will try to run on the live server.

    0
    Comment actions Permalink
  • Avatar
    Nikita Nikushkin

    Hi @WeHoDo,

    Glad to hear that the issue was resolved!

    Usually, the changes are reflected in Plesk immediately. Maybe the website page was cached and, thus, showed the incorrect info regarding the MariaDB version

    0
    Comment actions Permalink
  • Avatar
    Jorge Salazar (Edited )

    HI All,

     

    I am having issues to upgrade MySQL from 5.5 to maridb10.2.

     

    I am following the steps for Cloud Linux but when I am in the step 6 which is:

    /usr/share/lve/dbgovernor/mysqlgovernor.py --install

     

    The command returns an error saying that it could not install that because the file wasn't found:

    [root@localhost~]# /usr/share/lve/dbgovernor/mysqlgovernor.py --install
    !!!Before making any changing with database make sure that you have reserve copy of users data!!!
    !!!!!!!!!!!!!!!!!!!!!!!!!!Ctrl+C for cancellation of installation!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Instruction: how to create whole database backup - http://docs.cloudlinux.com/index.html?backing_up_mysql.html
    Start download current installed packages
    WARNING!!!! Package mariadb-5.5.60-1.el7_5.cloudlinux.x86_64 was not downloaded
    WARNING!!!! Package mariadb-libs-5.5.60-1.el7_5.cloudlinux.x86_64 was not downloaded
    WARNING!!!! Package mariadb-server-5.5.60-1.el7_5.cloudlinux.x86_64 was not downloaded
    Trying to load custom packages from yum
    WARNING!!!! Package mariadb-5.5.60-1.el7_5.cloudlinux.x86_64 was not downloaded
    WARNING!!!! Package mariadb-libs-5.5.60-1.el7_5.cloudlinux.x86_64 was not downloaded
    WARNING!!!! Package mariadb-server-5.5.60-1.el7_5.cloudlinux.x86_64 was not downloaded
    Start download packages for new installation
    Loaded plugins: fastestmirror, rhnplugin
    Cleaning repos: PLESK_17_8_11-extras PLESK_17_PHP56 PLESK_17_PHP70 PLESK_17_PHP71 PLESK_17_PHP72 PLESK_17_PHP73 cl-mysql-meta cloudlinux-x86_64-server-7 plesk-migrator plesk-migrator-tp
    Cleaning up list of fastest mirrors
    Other repos take up 106 k of disk space (use --verbose for details)
    Execution command: repoquery --requires cl-MariaDB-meta error
    Traceback (most recent call last):
    File "/usr/share/lve/dbgovernor/mysqlgovernor.py", line 349, in <module>
    main(sys.argv[1:])
    File "/usr/share/lve/dbgovernor/mysqlgovernor.py", line 213, in main
    if manager.install(opts.install_beta, opts.yes, opts.wizard):
    File "/usr/share/lve/dbgovernor/modules/base.py", line 205, in install
    self._load_packages(beta)
    File "/usr/share/lve/dbgovernor/modules/base.py", line 557, in _load_packages
    self._new_packages = self._load_new_packages(beta)
    File "/usr/share/lve/dbgovernor/modules/base.py", line 755, in _load_new_packages
    packages += exec_command("repoquery --requires %s" % name)
    File "/usr/share/lve/dbgovernor/utilities.py", line 491, in exec_command
    raise RuntimeError("%s\n%s" % (out, err))
    RuntimeError:
    failure: repodata/repomd.xml from cl-mysql-meta: [Errno 256] No more mirrors to try.
    http://repo.cloudlinux.com/other/cl7.6/mysqlmeta/cl-mariadb-10.2/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found

     

    So I tried to check why the repo link didn't work and if you go to that folder by surfing to it manually with a browser, then I realized that it doesn't exist for my Cloud Linux 7.6, please see below:

    What you get when you go to that URL:https://www.repo.cloudlinux.com/other/

    Parent Directory   -  
    [DIR] alt-python/ 11-Feb-2015 05:37 -  
    [DIR] cl5/ 24-Feb-2015 05:42 -  
    [DIR] cl6/ 12-Dec-2018 05:41 -  
    [DIR] cl6h/ 12-Dec-2018 05:41 -  
    [DIR] cl7.2/ 10-Dec-2018 10:28 -  
    [DIR] cl7/ 10-Dec-2018 10:28 -  
    [DIR] ea-php-for-centos/ 27-Feb-2017 03:30 -  
    [DIR] google-cloud/ 17-Jul-2017 01:41 -  
    [DIR] sclo/ 25-Sep-2017 03:18 -  

     

    So there is not folder for my version of CL7.6, so my question is how can I fix this?

     

    Should I edit repo manually and use the files for cl7.2?

     

    Could someone from Plesk review this, please?

     

    Thanks,

    Jorge

    0
    Comment actions Permalink
  • Avatar
    Tara

    On CloudLinux - /usr/share/lve/dbgovernor/db-select-mysql is deprecated and doesn't seem to work any more.  Should be using /usr/share/lve/dbgovernor/mysqlgovernor.py --mysql-version mariadbXX

    1
    Comment actions Permalink
  • Avatar
    Denis Bykov

    @Jorge Salazar
    Thank you for noticing.

    @Tara
    Thank you for pointing in the right direction.
    Indeed, 'db-select-mysql' is fetching the wrong repository link now. I updated the article with the correct command.

    1
    Comment actions Permalink
  • Avatar
    oןןǝɹǝɥɔuɐԀ

    Hi, there used to be a video here guiding you through the process (as I keep getting stuck at point 4 - Plesk on CentOS 6), I wanted to watch the video again to refresh (I can't change the enabled=1 to 0 for some reason) then can't exit the screen when I think I have done, the video has been removed as I guess it was outdated?

    Are you planning on adding an updated video, updating from 5.1 to 5.5 worked as expected, just this next part, thanks in advance.

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello @oןןǝɹǝɥɔuɐԀ

    The below instruction will help to achieve your goal, it explains how to edit files using vi:

    https://support.plesk.com/hc/en-us/articles/360001084114-How-to-edit-file-using-vi-utility-on-Linux-

    > Are you planning on adding an updated video, updating from 5.1 to 5.5 worked as expected, just this next part, thanks in advance.

    Thank you for showing interest, I will forward your feedback to the person in charge.

     

     

    1
    Comment actions Permalink
  • Avatar
    oןןǝɹǝɥɔuɐԀ

    Hi @Ivan,

    Thank you so much, I learnt something today. Completed :)

    1
    Comment actions Permalink
  • Avatar
    Alisa Kasyanova

    @oןןǝɹǝɥɔuɐԀ
    Glad to know that it helped :)

    0
    Comment actions Permalink
  • Avatar
    Victor Fournier (Edited )

    Hi All,

     

    I upgraded MariaDB version to the latest (mysql  Ver 15.1 Distrib 10.3.14-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2) on a plesk under Debian 9 but my sql version seems to stay at 5.5. What can I do to complete/upgrade mysql localhost to ensure the utilization of the 5.7 version ? (I made a link to verify it : http://fournierservices.dev/.test/scripts/check.php)

     

    Thank you so much for your help,

    Best regards,

    Victor

    0
    Comment actions Permalink
  • Avatar
    Nikita Nikushkin (Edited )

    Hi @Victor Fournier,

    Based on the provided information:

    # mysql -V

    mysql Ver 15.1 Distrib 10.3.14-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

    you performed an upgrade to MariaDB 10.3

    As far as I can see, the local MySQL server was upgraded successfully 

    Keep also in mind that Plesk supports MariaDB 10.3 in upcoming Plesk 17.9 only:

    MariaDB 10.3 support in Plesk

    The same information is available in the Notes section in this article:

    MariaDB 10.3 is not currently supported. Support for this version will be added in the upcoming release Plesk Onyx 17.9
    0
    Comment actions Permalink
  • Avatar
    Victor Fournier

    Hi @Nikita Nikushkin,

    Thank you for your answer and your help, I didn't notice that it was not yet supported in Plesk. Therefore, it's not possible to make the upgrade for MySQL 5.5 to 5.7 for client side until the full adoption of the 10.3 version ?

    If I downgrade to the 10.2, will it be possible ? The update from 5.5 to 5.7 is automatic or some commands should be run ? I didn't find any clue on the MariaDB website.

     

    Best Regards

    0
    Comment actions Permalink
  • Avatar
    Nikita Nikushkin

    Hi @Victor Fournier,

    > Thank you for your answer and your help, I didn't notice that it was not yet supported in Plesk. Therefore, it's not possible to make the upgrade for MySQL 5.5 to 5.7 for client side until the full adoption of the 10.3 version ?

    MySQL upgrade from 5.5 to 5.6/5.7 is possible by using steps from this article, as well as MariaDB upgrade from 5.5 to 10.0/10.1/10.2

    However, it is not possible to upgrade MariaDB to MySQL or vice versa as they are different products

    > If I downgrade to the 10.2, will it be possible ? The update from 5.5 to 5.7 is automatic or some commands should be run ? I didn't find any clue on the MariaDB website.

    MariaDB downgrade is not supported be Plesk and this procedure can break Plesk working capacity

    Also, the official MariaDB website tells that downgrading MariaDB is not supported as well:

    "Downgrading MariaDB is not supported. The only reliable way to downgrade is to restore from a full backup made before upgrading, and start the old version of MariaDB.

    Some people have reported successfully downgrading, but there are many possible things that can go wrong, and downgrading is not tested in any way by the MariaDB developers."

    In this article, it was strongly recommended to create a server snapshot/full server backup.

    So, if you have one, restore the server from it and perform the upgrade of MariaDB to the supported version one more time. It is the best way

    If you have no server backup, you can try to do the following at your own risk:

    1. Create a full server backup/snapshot
    2. Stop MariaDB service
    3. Remove MariaDB packages
    4. Disable MariaDB 10.3 repository
    5. Install the same MariaDB version as it was before the upgrade procedure
    6. Stop MariaDB service
    7. Free up the current "/var/lib/mysql" folder and move databases dumps to it. By default, they have to located in the "/var/lib/mysql_backup" folder
    8. Start MariaDB service
    9. Perform the upgrade of MariaDB again to the supported version by Plesk if it is required

    0
    Comment actions Permalink
  • Avatar
    Jorge Salazar

    Hi @Denis Bykov,

     

    Any updates about how I can update MySQL 5.5 to MariaDB10.2 for Cloud Linux 7.6?

     

    Regards,

    Jorge

    0
    Comment actions Permalink
  • Avatar
    Nick Plekhov

    Hello @Jorge Salazar,

    As I can see the issue is caused by incorrect repository settings. As the installation is invoked by mysqlgovernor.py, which is part of CloudLinux assets I suggest you contacting CloudLinux support directly for further help.

    0
    Comment actions Permalink
  • Avatar
    Jan Bludau
    1. cp -a /var/lib/mysql/ /var/lib/mysql_backup

    for this command provide "-v"

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

    on lage Database you would be glad to see the output of copying and not a window where nothing happen....

    Plesk 18.11.x is MariaDB 10.3 compatible, works without Problems.

    ---- SNIP ----

    6.1. Open/create the MariaDB.repo file in any text editor. In this example, we are using the vi editor:

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

    6.2. Add the content below to the file:

    [mariadb]
    name = MariaDB
    baseurl = http://yum.mariadb.org/10.3/centos7-amd64
    gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
    gpgcheck=1

    6.3. Save the changes and close the file.

     

    --- END OF SNIP ---

    1
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello @Jan,

    Thank you for the valuable notice!

    The article will be updated by its author soon.

    1
    Comment actions Permalink
  • Avatar
    Jan Bludau (Edited )

    Update  Plesk Onyx 17.8.11 Update Nr. 54 to Mariadb 10.4 from 10.3

    1. rpm -q --whatprovides mysql-server
    2. If it is installed and the command above gives output, remove using the following command:

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

    3. Configure MariaDB repository: open the Setting MariaDB repositories page, select your OS distro, release and a desired MariaDB version. Once done, the configuration that should be added to the /etc/yum.repos.d/MariaDB.repo file will appear.

      Here is an example for MariaDB 10.2:

      6.1. Open/create the MariaDB.repo file in any text editor. In this example, we are using the vi editor:

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

      6.2. Add the content below to the file:

      [mariadb]
      name = MariaDB
      baseurl = http://yum.mariadb.org/10.4/centos7-amd64
      gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
      gpgcheck=1

      6.3. Save the changes and close the file.

     

     --> new between the next step in the guide

    # yum -y update

    # yum install MariaDB-client MariaDB-server

    if you receive a conflict with "galera-25.3.26-1" because you had installed mariadb 10.3 

    # rpm -e galera-25.3.26-1.rhel7.el7.centos.x86_64 ... 

    # yum install MariaDB-client MariaDB-server

    --> Now follow the normal guide... 

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

    ....

    # service mariadb restart

    0
    Comment actions Permalink
  • Avatar
    Nikita Nikushkin

    Hi @Jan Bludau.

    Thank you for the provided instructions! Suppose, other users can found them useful

    However, keep in mind that MariaDB 10.4 is not supported by Plesk yet and, thus, all actions are performed at your own risk

    1
    Comment actions Permalink
  • Avatar
    Jan Bludau

    i've read the changelog nothing spezial there ... ok it was risky but its my development and test-server where i did it... mariabdb 10.4 works very well.

    Some advantages are:

    DoS Protection
    Bruteforce Detection

    Plesk should support the newest version officially.

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello @Jan,

    I have corrected the link to change log in this article, it should be for Plesk Obsidian:
    https://docs.plesk.com/release-notes/obsidian/change-log/

    There is the following record from the 8th of May:

    "Updated MariaDB to version 10.3.14."

    Glad to hear that version 10.4 worked fine for you.

    Product optimization for version 10.4 will need some additional time, with no ETA for now.

    0
    Comment actions Permalink
  • Avatar
    Rashid Qureshi

    I am getting this message:

     

    Package 1:mariadb-server-5.5.60-1.el7_5.x86_64 already installed and latest version.

     

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request