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

Follow

Comments

258 comments

  • 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
    Ivan Postnikov

    Learning Curve

    Thank you for the feedback

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello Miguel Ángel

    This option by itself shouldn't cause the issue.

    If it's still actual, submit a support request.

    0
    Comment actions Permalink
  • Avatar
    Jan Bludau

    Possible Bugfix while Upgrading from 10.3 directly to 10.5 on CentOS 8.x.

    file /usr/share/mysql/charsets/swe7.xml from install of MariaDB-common-10.5.8-1.el8.x86_64 conflicts with file from package mysql-common-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64

    run this command:

    sudo rpm -e mysql-common-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64 --nodeps

     

    0
    Comment actions Permalink
  • Avatar
    Mitchell van Bijleveld

    Is it normal that I see the following error message upgrading from 10.3.x to 10.5.x on Ubuntu 20?

    dpkg: mariadb-server-10.3: dependency problems, but removing anyway as you requested:

     plesk-mysql-server depends on mariadb-server | virtual-mysql-server; however:

      Package mariadb-server is not configured yet.

      Package virtual-mysql-server is not installed.

      Package mariadb-server-10.3 which provides virtual-mysql-server is to be removed.

     plesk-mysql-server depends on mariadb-server | virtual-mysql-server; however:

      Package mariadb-server is not configured yet.

      Package virtual-mysql-server is not installed.

      Package mariadb-server-10.3 which provides virtual-mysql-server is to be removed.

     plesk-mysql-server depends on mariadb-server | virtual-mysql-server; however:

      Package mariadb-server is not configured yet.

      Package virtual-mysql-server is not installed.

      Package mariadb-server-10.3 which provides virtual-mysql-server is to be removed.

     plesk-mysql-server depends on mariadb-server | virtual-mysql-server; however:

      Package mariadb-server is not configured yet.

      Package virtual-mysql-server is not installed.

      Package mariadb-server-10.3 which provides virtual-mysql-server is to be removed.

    0
    Comment actions Permalink
  • Avatar
    Mitchell van Bijleveld

    Why don't you offer a Graphical User Interface for this?

    0
    Comment actions Permalink
  • Avatar
    Michael Hall

    We are using Plesk in the AWS environment. You cannot log in as root, but instead, login as ec2-user then use sudo.

    Issue at step 1:

    sudo MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -u admin --verbose --all-databases --routines --triggers > /tmp/all-database
    cat: /etc/psa/.psa.shadow: Permission denied
    -- Connecting to localhost...
    mysqldump: Got error: 1045: "Access denied for user 'admin'@'localhost' (using password: NO)" when trying to connect. I did confirm the username is 'admin'

    How do I get past the Permission Denied? Thank you.

     

    0
    Comment actions Permalink
  • Avatar
    Thomas Hellwig

    Hi there,

    some changes for CloudLinux:

    1. Please add

    mariadb103 for MariaDB v10.3
    mariadb104 for MariaDB v10.4

    2. Please remove:

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

    This command is not needed. Console say it is already performed and you have to add -force...

     

    Big thank you and have a great day!

    0
    Comment actions Permalink
  • Avatar
    Vinod Vyas

    Hi,

    I am planning to upgrade mariadb to 10.5, below are few outputs, 

    [##### ssh]# rpm -qa | grep -i mysql
    perl-DBD-MySQL-4.023-6.el7.x86_64
    plesk-mysql-server-18.0-2.centos.7+p18.0.27.0+t200421.1927.noarch
    plesk-php80-mysql-8.0.0-1centos.7.201130.1749.x86_64
    plesk-php73-mysql-7.3.25-1centos.7.201126.1815.x86_64
    plesk-php74-mysql-7.4.13-1centos.7.201126.1815.x86_64

    [######]# rpm -qa | grep mariadb
    plesk-libmariadbclient-3.1-3.1.8-1centos.7.200603.1842.x86_64
    mariadb-libs-5.5.68-1.el7.x86_64
    mariadb-5.5.68-1.el7.x86_64
    mariadb-server-5.5.68-1.el7.x86_64

    [####### ssh]# cat /etc/*-release
    CentOS Linux release 7.9.2009 (Core)
    NAME="CentOS Linux"
    VERSION="7 (Core)"
    ID="centos"
    ID_LIKE="rhel fedora"
    VERSION_ID="7"
    PRETTY_NAME="CentOS Linux 7 (Core)"
    ANSI_COLOR="0;31"
    CPE_NAME="cpe:/o:centos:centos:7"
    HOME_URL="https://www.centos.org/"
    BUG_REPORT_URL="https://bugs.centos.org/"

    CENTOS_MANTISBT_PROJECT="CentOS-7"
    CENTOS_MANTISBT_PROJECT_VERSION="7"
    REDHAT_SUPPORT_PRODUCT="centos"
    REDHAT_SUPPORT_PRODUCT_VERSION="7"

    18.0.32.2
    Plesk Obsidian 18.0
    CentOS Linux release 7.9.2009 (Core)
    CentOS Linux release 7.9.2009 (Core)

    Is it okay to safely use instructions mentioned above for "Plesk on CentOS 7 / RHEL 7" and upgrade to mariadb 10.5

    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
    Victor Ma

    Hi Great guys,

    I install Mysql in the  AWS linux server, it is version mysql Ver 15.1 Distrib 5.5.68-MariaDB, for Linux (x86_64) using readline 5.1  (exported by Mysql -V).

    But I want upgrade 5.5.68-MariaDB to 10.3+ MarinaDB . In my server has no /etc/psa/.psa.shadow  folder and file. I tried to run the commands but there are many error. Could you tell me what I should to do please ? Thank you so much !

    error :

    ---> Package socat.x86_64 0:1.7.3.2-2.amzn2.0.1 will be installed
    --> Finished Dependency Resolution
    Error: Package: MariaDB-client-10.4.17-1.el8.x86_64 (mariadb)
    Requires: libc.so.6(GLIBC_2.28)(64bit)
    Error: Package: MariaDB-server-10.4.17-1.el8.x86_64 (mariadb)
    Requires: libc.so.6(GLIBC_2.28)(64bit)
    Error: Package: MariaDB-shared-10.4.17-1.el8.x86_64 (mariadb)
    Requires: libc.so.6(GLIBC_2.28)(64bit)
    Error: Package: galera-4-26.4.6-1.el8.x86_64 (mariadb)
    Requires: libboost_program_options.so.1.66.0()(64bit)
    Error: Package: MariaDB-backup-10.4.17-1.el8.x86_64 (mariadb)
    Requires: libc.so.6(GLIBC_2.28)(64bit)
    Error: Package: MariaDB-server-10.4.17-1.el8.x86_64 (mariadb)
    Requires: libcrypt.so.1(XCRYPT_2.0)(64bit)
    Error: Package: MariaDB-backup-10.4.17-1.el8.x86_64 (mariadb)
    Requires: libcrypt.so.1(XCRYPT_2.0)(64bit)
    Error: Package: MariaDB-client-10.4.17-1.el8.x86_64 (mariadb)
    Requires: libcrypt.so.1(XCRYPT_2.0)(64bit)
    Error: Package: MariaDB-server-10.4.17-1.el8.x86_64 (mariadb)
    Requires: libsepol >= 2.8-2.el8
    Installed: libsepol-2.5-8.1.amzn2.0.2.x86_64 (installed)
    libsepol = 2.5-8.1.amzn2.0.2
    Available: libsepol-2.5-6.amzn2.x86_64 (amzn2-core)
    libsepol = 2.5-6.amzn2
    Available: libsepol-2.5-8.1.amzn2.i686 (amzn2-core)
    libsepol = 2.5-8.1.amzn2
    You could try using --skip-broken to work around the problem
    You could try running: rpm -Va --nofiles --nodigest
    [

     

     

     

     

    0
    Comment actions Permalink
  • Avatar
    Dima Yaremenko

    Product version: Plesk Obsidian 18.0.33.0

         OS version: CentOS 7.9.2009 x86_64

         Build date: 2021/01/23 00:00

           Revision: db5d37f7d2a3360673aa3cba5d73bdda02aed535

    mysql  Ver 15.1 Distrib 5.5.68-MariaDB, for Linux (x86_64) using readline 5.1

     

    I was following this guide and it worked for me until step 8.

    After:

    #systemctl restart mariadb

    I'm getting:

    Redirecting to /bin/systemctl start mariadb.service

    Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.

    Can you help me, please?

    0
    Comment actions Permalink
  • Avatar
    A T

    Dima Yaremenko Did you check the error messages ? in cat /var/log/messages | grep mariadb

    The redirecting is normal it should be named 'mariadb.service' to see all service type # systemctl
    Hmm and I notice on my server wdcollect.service failed. Just upgraded mariadb 5.5 to 10.5

    Please share some more error message,..

     

    1
    Comment actions Permalink
  • Avatar
    A T (Edited )

    Hello all,
    I'm sharing my upgrade path and notes (for anyone that finds it usefull),
    
upgraded CentOS 7.9.2009 x86_64 Plesk 18.0.32.2 MariaDB 5.5.68-1 to MariaDB 10.5.8-1

    As we all should research, backup backup and snap'n'backup :] and read all the comments.

    After this I made a bash script step by step mainly to avoid typos, see below and !!! use at your own rist !!!

     

    
Requirements:
    
- create the repo file for the new MariaDB version in /etc/yum.repos.d/MariaDB.repo.disabled

    Steps I executed before running the script.

    - !!! Plesk Full backup, local and off-site # !!! 

    - !!! Full (VPS) server backup !!!

    - SMTP Server (postfix), stop service
 ( in Plesk > Tools & Settings > Server Management > Services Management )
    - !!! VPS Snapshot !!!

    - Suspend sites ( in Plesk > Domains > [tag: Select ALL] > [Change Status .. Suspend]
    I tried to upgrade as recommended by Redhat 5.5 > 10.0, it failed, (the repo) could not download so I set it to 10.5 (read below)

    Post upgrade notes:
    Restart SMTP Server (postfix)
    Check # systemctl (For me wdcollect.service failed becouse database connection) manualy restared it.
    There is an error in the /var/log/message from wdcollect, think its hardcoded in the (base64-whatever encoded file)
    "PHP Warning: date(): We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead in /usr/local/psa/admin/bin/modules/watchdog/wdcollect on line 194"
     

    As it seemed that the update was succesfull, database started website were running.

    A lot of other services where unable to connect in the background to the /var/lib/mysql/mysql.sock

    I've restored the connections, services are running but there are still some damaged attributes in the plesk database.

    I've removed the script for now.

    0
    Comment actions Permalink
  • Avatar
    mdantasf

    Hello guys.

    I followed all steps on this article onlye and my upgrade was a successful. Thank you for all comments, and observations.

    My server is: CentoOS 7.9, with Plesk last version, all updated.

    Thanks all people. ;)

    0
    Comment actions Permalink
  • Avatar
    Sid B

    Is it just me, or does it seem that updating the now old MariaDB 5.5.68-1 to faster MariaDB 10.5.8-1
    (on Centos 7.9 with Plesk Obsidian 18.0.33) is much more convoluted/complicated than it should be?

    I actually expected it to be available as a module to update/upgrade in the Plesk installer, but it isn't?
    I would like to upgrade Maria on our production server but am hesitant to do so when you see posts like

    "I've restored the connections, services are running but there are still some damaged attributes in the plesk database"

    from those who have attempted it.

    We have the same config as Arno running on a dedicated server

    Product version: Plesk Obsidian 18.0.33.0
    OS version: CentOS 7.9.2009 x86_64
    mysql  Ver 15.1 Distrib 5.5.68-MariaDB, for Linux (x86_64)

    Is Plesk going to add MariaDB 10 as a module install or upgrade to the Plesk installer
    any time soon?

     

    Sid B.

     

    3
    Comment actions Permalink
  • Avatar
    Jan Bludau

    Possible Bugfix for startup errors after successful upgrade.

    InnoDB: Upgrade after a crash is not supported. The redo log was created with MariaDB 10.4.18.

    mov the "ib_logfile0" to another name than it works.

    is stored in /var/lib/mysql/

    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.

    1
    Comment actions Permalink
  • Avatar
    Robert Asilbekov

    Sid B 

    > I actually expected it to be available as a module to update/upgrade in the Plesk installer, but it isn't?

    A database server is shipped by the OS vendor and Plesk itself does not manage its update/upgrade. Because the upgrade process can involve many pitfalls that only a server administrator would know about. 

    > Is Plesk going to add MariaDB 10 as a module install or upgrade to the Plesk installer
    any time soon?

    No information available at the moment. Please monitor Plesk Release Notes to have up-to-date information.

    0
    Comment actions Permalink
  • Avatar
    Sid B

    Plesk 'Installer & Updates'  lists/includes 6 versions of php, from 5.x to 8. We choose what to install, what not.

    The Instller lists/comes with 'standard' MariaDB 5.6. So why not MariaDB 10? Even as an option?

    CPanel does it, so I find it hard to believe Plesk can't.

     

    Sid

    1
    Comment actions Permalink
  • Avatar
    Robert Asilbekov

    Sid B,

    > The Instller lists/comes with 'standard' MariaDB 5.6. So why not MariaDB 10? Even as an option?

    It depends on the particular OS version, as the MariaDB is shipped by the OS vendor, not by Plesk. For example, by default, MariaDB 10.3 is coming with Ubuntu 20 and v10.1 with Ubuntu 18, v 5.5 is shipped with CentOS 7, etc...

    0
    Comment actions Permalink
  • Avatar
    Thomas Hellwig

    Hi there,

    my PLESK backend is showing MariaDB 10.5.9 but my server is running 10.5.10. I updatet from 10.5.9 and performed this 2 commands:

    #plesk bin service_node --update local
    # plesk sbin packagemng -sdf

    But it's still the old version in plesk backend...
    0
    Comment actions Permalink
  • Avatar
    Serverplan Plesk

    On CentOS Linux 7.9.2009 and Plesk Obsidian 18.0.37 both Automatic and Manually metohod didn't work.
    I need to lunch


    yum clean all


    to force correct version in new mariadb repo

    0
    Comment actions Permalink
  • Avatar
    Peter Debik

    Serverplan Plesk

    What exactly did not work, e.g. what error messages have been displayed? Was "yum clean all" your solution?

    0
    Comment actions Permalink
  • Avatar
    Peter Debik (Edited )

    I'd like to add this confirmation for CentOS 7.9: Following the steps in the "Plesk on CentOS 7 / RHEL 7" section, the upgrade is correctly executed.

    However, here are some add-on suggestions to the instructions:

    1) Ensure that innodb_fast_shutdown variable is not 2 or 3. The default of this variable is 1. It can be 1 or 0 for the shutdown, but not higher. The reason for this is that only on 1 or 0 all open transactions are guaranteed to be completed and no redo/undo operations remain. Verify in SQL with

    > show variables LIKE 'innodb_fast_shutdown';

    Similar issue with innodb_force_recovery. This must be less then 3:

    > show variables LIKE 'innodb_force_recovery';

    2) I suggest to "service psa stopall" and also to stop dovecot and postfix before stopping MariaDB, because some services might need to access the database to look something up. Imagine a mail is coming in, some service needs to look something up for it in the database and fails so it might discard the mail etc. and we might never know ... The upgrade process on a server with approx. 300 databases only took a few minutes including the data directory backup.

    3) Removal of the existing MariaDB-server package is a must. If this step fails, do not proceed.

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

    It can fail for example when you are just as unattentive as me in one case when I copied the command from the script file and included the double quotes around the single-quoted rpm command. If the existing MariaDB-server package is not removed, the installation will not install the upgraded MariaDB-server package. Should you run into an issue where only some packages are installed, it is no problem to repeat the installation later for all. Yum will only install the ones that are new or updated.

    4) After the upgrade has finished and all seems well, run
    # plesk repair db -y
    because if you have been using an old version of MariaDB, some field definitions like date and time fields might not be up to date for the Plesk database with the new database scheme.l

    2
    Comment actions Permalink
  • Avatar
    Sylvio

    Hi on Ubuntu 18.04 bionic... I followed your procedure and had 2 issues :
    1) mirror.truenetwork.ru is not responding, I used sfo1.mirrors.digitalocean.com instead (found on mariadb.com)
    2) apt-get install gave me : "mariadb-server : Depends: mariadb-server-10.5" "Unable to correct problems, you have held broken packages". I googled and solved this by :

    curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
    apt update
    apt upgrade
    apt remove mysql-common
    apt install mariadb-server

    found on stackoverflow.com.

    Then after first start of mariadb service I had 2 errors messages, but this was only for the first start before the end of the procedure... finger cross ;-)

    0
    Comment actions Permalink
  • Avatar
    Michael

    I am unable to upgrade from MariaDB 10.1 to 10.2. I get this error:

    This is a brief description of the upgrade process. Important details
    can be found in the MariaDB manual, in the Upgrading section.
    ******************************************************************
    error: %pre(MariaDB-server-10.2.41-1.el7.centos.x86_64) scriptlet failed, exit status 1
    Error in PREIN scriptlet in rpm package MariaDB-server-10.2.41-1.el7.centos.x86_64
    MariaDB-server-10.1.48-1.el7.centos.x86_64 was supposed to be removed but is not!
    Verifying : MariaDB-server-10.1.48-1.el7.centos.x86_64 1/2
    Verifying : MariaDB-server-10.2.41-1.el7.centos.x86_64 2/2

    Failed:
    MariaDB-server.x86_64 0:10.1.48-1.el7.centos MariaDB-server.x86_64 0:10.2.41-1.el7.centos

    Complete!

    Anyone has any ideas?

    0
    Comment actions Permalink
  • Avatar
    Henk Bartels

    Hello Michael,

    I have the exact same problem when trying to update MySql (MariaDB).
    Unable to remove the old SQL version....

    I hope that if you find a solution, you will put it here.

     

    Henk

    0
    Comment actions Permalink
  • Avatar
    Del C (Edited )

    For the mysqldump command you should add --hex-blob to the parameters. 

    -hex-blob will dump binary columns using hexadecimal notation.

    If you do not do this, then depending on your db contents, if you need to rely on that dump then you may get an error similar to: Mysql ERROR at line 1153: Unknown command '\'

    1
    Comment actions Permalink
  • Avatar
    maartenv

    There is an error in the attached script.
    This doesn't do anything, the files and directories are copied to /dev/null

    echo "creating backup of mysql directory"
    cp -v -a /var/lib/mysql/ /var/lib/mysql_backup 2&> /dev/null

    It should be something like this, copying the errors to /dev/null

    echo "creating backup of mysql directory"
    cp -v -a /var/lib/mysql/ /var/lib/mysql_backup 2> /dev/null

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request