Upgrade MariaDB 10.1 to 10.4 — CyberPanel - WebHosting Control Panel for OpenLiteSpeed
CyberHosting

Upgrade MariaDB 10.1 to 10.4

edited January 24 in Database Server
Hi, Could someone please tell a short instruction on how to safely upgrade db from v10.1 to the latest v10.4 on CentOS 7.6. Preserving all the cyberpanel important configuration and relations to other modules.

Comments

  • edited January 28
    Copy your my.cnf to a backup

    cp /etc/my.cnf /etc/my.cnf-backup

    Remove the previous installations

    stop mariadb

    systemctl stop mariadb

    yum -y remove MariaDB-server MariaDB-client galera

    edit the current repo to use the 10.4 branch

    nano (or another editor)

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

    change the baseurl from 10.1 to 10.4

    save and exit

    now run the following commands

    yum clean all

    yum -y install MariaDB-server MariaDB-client galera

    Copy back the my.cnf file

    cp /etc/my.cnf.backup /etc/my.cnf

    Ensure mariadb is set to run from boot and by command line

    systemctl enable mariadb

    now ensure all databases are upgraded for this you will need to get the mysql password

    cat /etc/cyberpanel/mysqlPassword

    upgrade the databases with

    mysql_upgrade -uroot -p

    Now start mariadb

    systemctl start mariadb

    This is based on having ssh access and root if you dont try in the provided web terminal in Cyberpanel
    Cyberpanel Managed & Unmanaged Shared & VPS Hosting by Cyberpanel Experts.
    https://www.cyberhosting.org
    You can now earn with the Cyberhosting affiliate scheme. Join today
    https://www.cyberhosting.org/affiliates/
  • edited March 2
    @hennaboy said:

    > This is based on having ssh access and root if you dont try in the provided web terminal in Cyberpanel

    Hi. Is there a manual for ubuntu 18?
  • sudo apt-get install software-properties-common
    sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
    sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mirror.mva-n.net/mariadb/repo/10.4/ubuntu bionic main'

    service mysql stop
    apt remove mariadb-server mariadb-client

    apt update
    apt install mariadb-server mariadb-client

    service mysql start

    mysql_upgrade -uroot -p (get the password as above)

    secure the install with

    mysql_secure_installation -uroot -p (password)

    You do not need to set a root pass as you already have one.
    Cyberpanel Managed & Unmanaged Shared & VPS Hosting by Cyberpanel Experts.
    https://www.cyberhosting.org
    You can now earn with the Cyberhosting affiliate scheme. Join today
    https://www.cyberhosting.org/affiliates/
  • edited April 7
    @hennaboy thank you for the Ubuntu commands above. I ran the commands to upgrade Mariadb 10.1 to 10.2 replacing '10.4' with '10.2 ' in the add-apt-repository command, the upgrade process completed but Mariadb version remained at 10.1. I think maybe I need to either remove or disable existing Mariadb repos.

    I tried running 'apt-key adv --fetch-keys ...' again and noticed the error 'Invalid Argument'. I tried another key repo and it gave the same error. I've searched the web but not found any solution. This is on a Ubuntu DO droplet. Also tried:

    wget -O http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xF1656F24C74CD1D8 | apt-key add -

    This said: g pg: no valid OpenPGP data found.
  • Following the instructions at https://mariadb.com/kb/en/installing-mariadb-deb-files/ for Ubuntu I used the following commands:

    curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
    apt-get install software-properties-common
    add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.2/ubuntu bionic main'
    service mysql stop
    cat /etc/cyberpanel/mysqlPassword
    apt remove mariadb-server mariadb-client
    apt update
    apt install mariadb-server mariadb-client
    service mysql start
    mysql_upgrade -uroot -p

    This worked except that despite specifying the 10.2 repo the process installed 10.4, maybe that was because I used 'apt update' before 'apt install'.
  • nano /etc/yum.repos.d/MariaDB.repo

    dont have it :(( centos
  • I successfully completed the process with the following codes (for centos7 and ceyberpanel v2.1)

    systemctl stop mariadb
    yum -y remove MariaDB-server MariaDB-client galera
    yum clean all

    yum -y install wget
    wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
    chmod +x mariadb_repo_setup
    sudo ./mariadb_repo_setup
    yum -y install MariaDB-server MariaDB-client galera

    systemctl enable mariadb
    systemctl start mariadb
  • > I tried running 'apt-key adv --fetch-keys ...' again and noticed the error 'Invalid Argument'. I tried another key repo and it gave the same error. I've searched the web but not found any solution. This is on a Ubuntu DO droplet. Also tried:

    Try this:

    wget https://mariadb.org/mariadb_release_signing_key.asc
    sudo apt-key add mariadb_release_signing_key.asc
  • Maria DB upgrade to 10.5 : https://mariadb.com/docs/deploy/upgrade-community-server-cs105-centos7/
  • When you upgrade a major version of mariadb you need to run the command after starting mysql_upgrade to upgrade the mariadb tables (does not affect the tables of your own databases).

    This is now in the code for upgrading to 10.5 by running cyberpanel upgrade command in ssh
    Cyberpanel Managed & Unmanaged Shared & VPS Hosting by Cyberpanel Experts.
    https://www.cyberhosting.org
    You can now earn with the Cyberhosting affiliate scheme. Join today
    https://www.cyberhosting.org/affiliates/
  • edited September 24
    Type your comment> @Aykut24 said:
    > nano /etc/yum.repos.d/MariaDB.repo
    >
    > dont have it :(( centos

    Don't have it either in CentOS 8.2 . Also just installed a fresh server of CentOS 8.2 with CyberPanel 2.0 build 3 and it finishes and uses MariaDB 10.3. I've tried to upgrade using the post at the top of the page from @hennaboy (which previously worked great) to MariaDB 10.4 and 10.5 with no success.

    The instructions from @usmannasir here https://cyberpanel.net/docs/upgrading-to-mariadb-10-5-manually/ don't work as well since /etc/yum.repos.d/mariadb.repo doesn't exist.
    You can upgrade manually but it breaks MariaDB when done.

    > @IsaiahAbe said:
    > Maria DB upgrade to 10.5 : https://mariadb.com/docs/deploy/upgrade-community-server-cs105-centos7/
    >
    This doesn't work either as: sudo yum remove "MariaDB-*" has no results.

    Wondering if adding this from @usmannasir https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/install/mysql/MariaDB.repo
    and editing centos 7 to 8 and 10.1 to 10.4 will do the trick and hit the repo. I'd be the guinea pig and test it, but can't do it on this server at the moment.

    Looking for help :)
  • 10.4 and 10.5 is difficult on centos 8 and requires several manual changes to implement which is why it has not been included in 2.0.3
    Cyberpanel Managed & Unmanaged Shared & VPS Hosting by Cyberpanel Experts.
    https://www.cyberhosting.org
    You can now earn with the Cyberhosting affiliate scheme. Join today
    https://www.cyberhosting.org/affiliates/
  • It's not for the faint-hearted and it's not 100% tested IE there may be issues with other systems such as mail or something not tested. This was done on a clean test box and I have not tested other Cyberpanel functions or website functions such as mail, mailscanner etc.

    Steps for Centos 8 to 10.4 or 10.5

    Create the MariaDB.repo at /etc/yum.repos.d

    # MariaDB 10.5 CentOS repository list - created 2020-09-08 14:54 UTC
    # http://downloads.mariadb.org/mariadb/repositories/
    [mariadb]
    name = MariaDB
    baseurl = http://yum.mariadb.org/10.5/centos8-amd64
    module_hotfixes=1
    gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
    gpgcheck=1
    enabled=1

    For 10.4 replace the 10.5 base URL

    Now disable gf.repo by setting the enabed=1 to enabled=0 you will find this in the same directory /etc/yum.repos.d

    Now clear everything and reset the cache

    yum clean all
    yum makecache

    yum remove mysql-common
    yum remove dovecot23 dovecot23-mysql postfix3 postfix3-mysql

    I did mention manual changes in the post above ;)

    yum upgrade --allowerasing

    yum install mariadb-server mariadb-client galera perl-DBD-MySQL

    yum install dovecot postfix dovecot-mysql postfix-mysql perl-Carp-Clan postfix-perl-scripts perl-Bit-Vector perl-Date-Calc

    Optional reinstall some of the removed weak dependency packages

    yum install mariadb-errmsg mariadb-backup

    If all is well then you should now be at a point with 10.4 or 10.5 installed with postfix and dovecot also reinstalled.

    Start and Enable Mariadb

    systemctl enable mariadb
    systemctl start mariabd

    Get your root mariadb password

    cat /etc/cyberpanel/mysqlPassword

    run mysql_upgrade

    mysql_upgrade -uroot -p[password obtained using the cat command above]

    and that should be about it.

    Do not do this if you are not prepared for something to

    a. go wrong
    b. cannot fix it yourself
    c. using cloudlinux with MySQL governor as it currently does not support 10.5
    Cyberpanel Managed & Unmanaged Shared & VPS Hosting by Cyberpanel Experts.
    https://www.cyberhosting.org
    You can now earn with the Cyberhosting affiliate scheme. Join today
    https://www.cyberhosting.org/affiliates/
  • @hennaboy Many thanks for the detailed upgrade description. May give it a shot this afternoon and will post back results. If anyone else attempts this, please post your findings.
    We're looking at building a new Magento 2.4 server which requires MariaDB 10.4 and had hoped that CyberPanel had installed and used 10.5 (or 10.4) on a fresh OS and panel install. Makes sense why @usmannasir opted to keep 10.3 as the stable.

    Wondering if simply removing 10.3, adding the repo file to etc/yum.repos.d and using @usmannasir 's instructions in the wiki would complete the process. Thinking out loud...
  • edited September 25
    I noticed that Centos 7 now installs with mysql 10.5 out of the box.
  • Type your comment> @themew said:
    > @hennaboy Many thanks for the detailed upgrade description. May give it a shot this afternoon and will post back results. If anyone else attempts this, please post your findings.
    > We're looking at building a new Magento 2.4 server which requires MariaDB 10.4 and had hoped that CyberPanel had installed and used 10.5 (or 10.4) on a fresh OS and panel install. Makes sense why @usmannasir opted to keep 10.3 as the stable.
    >
    > Wondering if simply removing 10.3, adding the repo file to etc/yum.repos.d and using @usmannasir 's instructions in the wiki would complete the process. Thinking out loud...
    >

    No because CP is using gf.repo for postfix and dovecot which then installs some of the packages I am stating you need to remove. They conflict with the upgrade so you have no option but to follow the steps I posted.
    Cyberpanel Managed & Unmanaged Shared & VPS Hosting by Cyberpanel Experts.
    https://www.cyberhosting.org
    You can now earn with the Cyberhosting affiliate scheme. Join today
    https://www.cyberhosting.org/affiliates/
  • @hennaboy Still a mess. The AppStream issue with CentOS 8 still persists with errors after install. Didn't get a chance to check to see if dovecot was working or not. There's got to be an easier way to install CyberPanel 2.0 build 3 with MariaDB 10.4...
  • Type your comment> @themew said:
    > @hennaboy Still a mess. The AppStream issue with CentOS 8 still persists with errors after install. Didn't get a chance to check to see if dovecot was working or not. There's got to be an easier way to install CyberPanel 2.0 build 3 with MariaDB 10.4...

    What errors?
    Cyberpanel Managed & Unmanaged Shared & VPS Hosting by Cyberpanel Experts.
    https://www.cyberhosting.org
    You can now earn with the Cyberhosting affiliate scheme. Join today
    https://www.cyberhosting.org/affiliates/
  • After the reinstall you get a page of errors like this:

    Error: Transaction check error: https://pastebin.com/VjSpvCsX

    I didn't copy my errors from the terminal but replace 10.3.11 with 10.4.x -- different version of MariaDB but same errors.

    Even if we stay with MariaDB 10.3, this makes me question how we'll ever upgrade to 10.4 or 10.5 in the future. Also wondering why we're using gf.repo when in @usmannasir wiki, he clearly is using the mariadb repo as he mentions it at the beginning of the
  • Type your comment> @themew said:
    > After the reinstall you get a page of errors like this:
    >
    > Error: Transaction check error: https://pastebin.com/VjSpvCsX
    >
    > I didn't copy my errors from the terminal but replace 10.3.11 with 10.4.x -- different version of MariaDB but same errors.
    >
    > Even if we stay with MariaDB 10.3, this makes me question how we'll ever upgrade to 10.4 or 10.5 in the future. Also wondering why we're using gf.repo when in @usmannasir wiki, he clearly is using the mariadb repo as he mentions it at the beginning of the

    Its good that you are at 10.3, its the last version that is compatible with percona or mysql 8 incase you decide to migrate away in the future, if you upgrade to 10.4 it might make your database stuck with mariadb only.
  • Type your comment> @Numeriku said:

    > Its good that you are at 10.3, its the last version that is compatible with percona or mysql 8 incase you decide to migrate away in the future, if you upgrade to 10.4 it might make your database stuck with mariadb only.

    No question 10.3 is very stable and doesn't go eol until 2023, but Magento 2.4 requires 10.4 which is what we build with LiteSpeed and really want to continue using CyberPanel rather than another panel we've been using. Really don't want this issue to be a dealbreaker for us since we really like the CyberPanel/LiteSpeed combination.
  • Are you sure you did the yum upgrade command with --allowerasing as that is what I used to overcome the error you have stated in your pastebin
    Cyberpanel Managed & Unmanaged Shared & VPS Hosting by Cyberpanel Experts.
    https://www.cyberhosting.org
    You can now earn with the Cyberhosting affiliate scheme. Join today
    https://www.cyberhosting.org/affiliates/
Sign In or Register to comment.
CyberPanel Discord

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!