DEV Community

Mike Whitaker
Mike Whitaker

Posted on

Upgrading MySQL 5.7 to MariaDB 10 on Ubuntu 18

FX: Stands up amid very large pile of yak hair

Right. If you're ever in the unfortunate space of needing to upgrade MySQL 5.7 to MariaDB 10 on Ubuntu 18.04 LTS, here's what to do and what not to do.

1) next time, upgrade to 20.04.5 LTS first, and most/all of this will go away :D

2) do NOT install the default mariadb-server-10.1 package, as its mysql_upgrade script does not know how to convert from mysql-5.7 tables.

3) Go here and select your Ubuntu version and a suitable MariaDB version.

4) Cut and paste the appropriate repo lines, and do what it says.

5) if it doesn't run mysql_upgrade for you, run it as root.

6) You may find that it hangs on starting the MariaDB server. This is an issue with apparmor, and can be fixed by following these instructions (reproduced here just in case of link rot).

sudo systemctl stop mariadb
echo "/usr/sbin/mysqld { }" | sudo tee /etc/apparmor.d/usr.sbin.mysqld
sudo apparmor_parser -v -R /etc/apparmor.d/usr.sbin.mysqld
Enter fullscreen mode Exit fullscreen mode

The above should display Removal succeeded for "/usr/sbin/mysqld"

And then, to stop it reappearing on reboot:

sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/usr.sbin.mysqld
Enter fullscreen mode Exit fullscreen mode

Finally:

sudo systemctl start mariadb
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
thomasbnt profile image
Thomas Bnt ☕

Hello ! Don't hesitate to put colors on your codeblock like this example for have to have a better understanding of your code 😎

console.log('Hello world!');
Enter fullscreen mode Exit fullscreen mode

Example of how to add colors and syntax in codeblocks