By lizlynch99
I set up a CentOS7 LAMP server a couple of months ago, and installed MariaDB with sudo yum install mariadb-server mariadb. It seemed to default to MariaDB 5.5. But I’d like to upgrade to 10.1 - unless anyone thinks there is any reason this is not a good idea?
What is the easiest and safest way to do this?
Thanks
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hey there,
It’s fairly painless. Prior to doing anything I’d recommend exporting your databases as backups and if this is a DigitalOcean Droplet, I’d recommend creating a snapshot.
Here is the readout from my current Droplet which is similar to your example:
# cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
# mysql -v
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.44-MariaDB MariaDB Server
I’m going to remove MariaDB with this command:
yum remove mariadb mariadb-server
Create /etc/yum.repos.d/MariaDB.repo and place the following contents into it:
# MariaDB 10.1 RedHat repository list - created 2016-02-06 03:30 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/rhel7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
Reinstall MariaDB with this command:
yum install mariadb mariadb-server
(Accept the importing of the RPM-GPG-KEY-MariaDB key with a “Y”)
You’ll want to start MariaDB and make sure it’s enabled to start on boot:
systemctl start mariadb
systemctl enable mariadb.service
IMPORTANT: You can then run mysql_upgrade to update the databases to the new MariaDB version.
And the upgrade is now complete:
# mysql -v
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 10.1.11-MariaDB MariaDB Server
Happy coding,
Jon Schwenn Platform Support Specialist DigitalOcean
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.