I already have several MySQL DBs running on my Ubuntu 14.04 Server, and I would like to migrate these as smoothly as possible to the compatible MariaDB. I'm also using PHPMyAdmin. Is there a different way to do this than to export all data and then reimport it all after installation?
2 Answers
It turned out to be as simple as:
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get install mariadb-server
This won't break your phpmyadmin, or any webapp, as long as you say no, when asked if you want to delete your database and you use the same credentials you used for you mysql-DB. Also back up your data before doing this.
- 2,563
- 7
- 29
- 46
-
What about migrating settings? Surely these have separate configuration locations in /etc and (likely) different configuration syntax? – thomasrutter Oct 05 '14 at 10:23
-
1It will migrate settings automatically, but warn you about possible incompatibilites when installing mariadb – Andreas Hartmann Oct 05 '14 at 11:21
-
2It didn't ask for me an option to delete any databases, also used my old my.cnf as base configuration. This was one of the smoothest upgrades I've done so far. – Arda Nov 05 '14 at 21:04
-
Also, to mention official site of MariaDB has newer versions [available for installation as repositories or debs](https://downloads.mariadb.org/mariadb/repositories/#distro=Ubuntu). Ubuntu repos currently give me v5.5, but mariadb repos give me v10.1, which has quite a bit differences. – Arda Nov 05 '14 at 23:05
-
1When you uninstall MySQL it should've asked you whether to remove the databases – Andreas Hartmann Nov 06 '14 at 07:31
-
Weird, in my playground DO droplet it didn't ask for me, but my production VPS just asked me. – Arda Nov 06 '14 at 11:44
-
The above instructions *mostly* work, but apt-get gave up on my system because of a dependency on libmysqlclient18. aptitude explained why...it tried to get the mysql one from the trusty repository instead of the maria one. I had to say 'no' to the first couple of options aptitude offered. Eventually it offered to get libmysqlclient18 from the maria repository. Answering 'yes' to that allowed the installation to proceed uneventfully. – Apr 28 '15 at 01:06
-
This worked well for my 14.04 LTS system, except there were no prompts at all. It appears to just have made correct assumptions. All my databases were preserved and upgraded automatically. It's worth noting that this removed MySQL Workbench. Since the apt version has a dependency on mysql-client, I was not able to re-install it using apt. I had to download the community version deb file directly from the [MySQL site](http://dev.mysql.com/downloads/workbench/). After installation, settings in workbench were still in tact. – Dale C. Anderson Mar 01 '16 at 22:19
-
This will not work to transition from mysql 5.7 unless you first add the repositories for mariadb 10.2. The default (older) version of mariadb available in ubuntu 14.04 doesn't know how to convert mysql 5.7 databases. Follow instructions [here](https://downloads.mariadb.org/mariadb/repositories/#mirror=digitalocean-nyc&distro=Ubuntu&distro_release=xenial--ubuntu_xenial&version=10.2) to install mariadb 10.2. – Mark Aug 25 '18 at 20:44
Andreas Hartmann's answer is incomplete, and it also removes PHPMYADMIN and MYSQLI
So, in addition to mariadb-server, you should install the following:
apt-get install mariadb-client libmariadbclient-dev libmariadbd-dev phpmyadmin
To get phpMyAdmin working again on SSL only, you'll need to reconfigure etc/phpmyadmin/apache.conf to include the http=>https rewrite.
If you're running a LAMP server with Postfix with Dovecot, you will also need to do the following:
**** Everything worked except MAIL. Dovecot not configured properly and can’t send/receive mail.
apt-get install dovecot-mysql fixed mail receipt but sending is still blocked.
apt-get install libclass-dbi-mysql-perl
apt-get install php-auth
apt-get install php-pear
apt-get install postfix-mysql
**** EVERYTHING WORKING FINE HERE
The last three (3) apt-get statements might not be necessary, since libclass-dbi-mysql-perl might install them for you, depending on how update your package list is.
If you are running other software, you will need to test it and install any missing libraries that might have been removed by auto-dependency calculations.
Update
The FTP service was removed as well (PureFTPD in my case) and needed to be installed:
apt-get install pure-ftpd-common pure-ftpd-mysql
- 369
- 2
- 12
-
2Actually, for me phpmyadmin wasn't removed. Also, I doubt that you would need these packages just to get the server running, especially these dev packages are meant for developers and not for end users. – Andreas Hartmann Jan 20 '15 at 07:29