How to Upgrade MySQL and Install MariaDB 10.5 on Ubuntu 18.04 LTS and 16.04 LTS
In this tutorial we’ll upgrade/install to Mariadb 10.5 on Ubuntu 18.04 LTS, 16.04 LTS and with vestacp when you install MySQL version 5.7 will be install on Ubuntu 16 and 18. This tutorial will also work with vestacp installed soon 18.04 will be supported by vestacp. MariaDB is designed as a drop-in replacement of MySQL with more features, new storage engines, fewer bugs, and better performance. MariaDB is developed by many of the original developers of MySQL who now work for the MariaDB Foundation and the MariaDB Corporation, and by many people in the community. To upgrade follow this simple steps to upgrade it to latest version.
Login as root and follow the commands one by one.
First Add mariadb apt repository :
For 18.04 LTS :
sudo apt-get install software-properties-common sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 sudo add-apt-repository 'deb [arch=amd64] https://mirror.23m.com/mariadb/repo/10.5/ubuntu bionic main'
For 16.04 LTS :
apt-get install software-properties-common apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 add-apt-repository 'deb [arch=amd64,i386,ppc64el] https://mirror.23m.com/mariadb/repo/10.5/ubuntu xenial main'
To Upgrade :
This is only for the upgrade and follow this commands :-
Stop and remove MySQL server :
service mysql stop apt remove mysql-client mysql-client-core mysql-server mysql-server-core or apt remove mysql-server
Now we’ll Update/install
apt update apt install mariadb-server
When the installer ask for the password just leave it blank it will ask to set the password 3-4 times for all time leave the password blank (imp when upgrading from mysql to mariadb only)
Well Mariadb is now installed and you just need to start mariadb server and upgrade the database :
service mysql start
Now upgrade the database :
mysql_upgrade --force
To Install :
This is only for fresh installation don’t use it for the upgrade.
apt update apt install mariadb-server
When it will ask you to enter root password please enter and remember the password, after successful installation start the mariadb server :
service mysql start
For VestaCP only extra config :
rm -rf /etc/mysql/my.cnf ln -s /etc/mysql/mysql.cnf /etc/mysql/my.cnf
thats it you can login as root for the checks.