MySQL to Maria DB: Quick Migration Guide for Debian

When a product that works and pays off, and is open source, falls into the hands of a company whose goal is none other than to make more and more money, the world trembles.

It already happened with OpenOffice at the time and now it's the turn of MySQL. Bearing to Oracle behind nobody knows what can happen and it is good to know that there are alternatives and specifically the best of all is Maria D.B..

Quoting Wikipedia:

MariaDB is a database management system derived from MySQL with GPL license. It is developed by michael widenius (founder of MySQL) and the developer community FOSS. Enter two storage engines new, one called Aria -which replaces with advantages MyISAM- and another call XtraDB -replacing InnoDB. It has a high compatibility with MySQL since it has the same commands, interfaces, APIs and libraries, its objective being to be able to change one server for another directly.

So without further ado let's see how to go from MySQL a Maria D.B..

It is important to know that for this to work 100%, we must have the same version of MySQL (5.5) and Maria DB (5.5)

Migrating from MySQL to Maria DB

This process cannot be done hot. In other words, we have to stop for a moment our services and processes that are executing MySQL.

# service stop apache2 # service stop nginx # service stop mysql

In this case we stop Apache or NGinx depending on which one we are using, and of course we also stop MySQL.

Later we make a backup of our MySQL database:

# mysqldump -u root -p --all-databases > mysqlbackup.sql

And we remove all packages related to MySQL:

# aptitude remove mysql-server-core-5.5 mysql-server-5.5 mysql-server mysql-common mysql-client-5.5 libmysqlclient18

Now we have to install Maria DB. Unfortunately, it is not in the Debian repositories yet, but we can install it using its own repositories. For other distributions, you can see the instructions here.

We add the following to our /etc/sources.list file:

# MariaDB 5.5 repository list - created 2013-08-02 13:48 UTC # http://mariadb.org/mariadb/repositories/ deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/debian wheezy main deb-src http://ftp.osuosl.org/pub/mariadb/repo/5.5/debian wheezy main

Then we update and install Maria DB:

sudo aptitude update sudo apt-get install mariadb-server

We start Maria DB (if it did not do it automatically) and check that it is working:

# mysql -u root -p -Be 'show databases' Enter password:

Some settings have changed considerably between MySQL and MariaDB, however it is very easy to work with. Almost everything that changed has to do with the mechanisms that have been replaced, for example, replication. We only have to copy the performance optimization options that we had in the file my.cnf de MySQL, and reconfigure the rest by hand.

For example, these data:

bind-address = 127.0.0.1 max_connections = 10 connect_timeout = 30 wait_timeout = 600 max_allowed_packet = 16M thread_cache_size = 256 OR sort = 16M bulk_insert_buffer_size = 16M tmp_table_size = 64M max_heap_table_size = 64M

We make the necessary changes and restart Maria DB.

# service mysql restart Stopping MariaDB database server: mysqld. Starting MariaDB database server: mysqld. . . Checking for corrupt, not cleanly closed and upgrade needing tables .. # mysql -u root -p -Be 'show databases' Enter password:

Yes, Maria D.B. keep the same mysql name to restart the service, in order to maintain better compatibility. If everything is fine, then we start the rest of the services:

# service apache2 start # service nginx start

And ready. If we want to go back (which I don't recommend), we just have to run:

# service mysql stop # apt-get remove mariadb-server-5.5 mariadb-common mariadb-client-5.5 libmariadbclient18 # apt-get install mysql-server

Source: Article taken and modified from BeginLinux


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Mauricio said

    As the load of the backup of the database is missing.

    1.    elav said

      I think not necessarily, but thanks for the clarification. We did the backup in case the current Database fails, since it seems to me that both use the same DB. I will have to read more on the subject.

  2.   ozkar said

    Fedora 19 already comes with Maria by default, but neither short nor lazy I migrated my web-apps to PostgreSQL, since MySQL hit us the horns, I hope PostgreSQL stays faithful for at least 2-3 years.

    1.    elav said

      ArchLinux also includes Maria DB 😀

      1.    ozkar said

        You have an Arch vice ... Even I have weak teeth and want to use it again ... but I'm lazy. 😀

  3.   3ndriago said

    I see a trend of systems including support for MariaDB and according to what I have read it seems to be at the level of MySQL and even surpass it in some aspects, but my question is: the fact that now Oracle is behind MySQL to migrate and so by the way abandoning a time-tested and million-use bd manager?

    1.    elav said

      You are right. Just saying Oracle is reason enough to run out of MySQL. Also, Maria DB is a fork of MySQL maintained by the creator of MySQL and the Community. I don't know about you, but at least that gives me a lot of security. And if we add to that that the compatibility is very good, because I think there are no excuses to switch to Maria DB.

      😉

      1.    eliotime3000 said

        And that is why I refuse to install Java on my Debian. I hardly use OpenJDK with IcedTea and it works wonders, and better than Java.

      2.    3ndriago said

        Well, man, I'm sure you must have your reasons for hating Oracle (it smells like those that make you hate Microsoft, Apple and even Google) but since Oracle hasn't done anything to me ... and I think I was going to give you a SPARC for your birthday XD

        1.    eliotime3000 said

          It refers to the software level, not the hardware level.

          1.    3ndriago said

            No, if we are going to hate, we hate everything, that half measures is not cool ... hehehehehehe

          2.    elav said

            xDDD

  4.   st0rmt4il said

    Thanks elav, by the way, is it advisable to have both web servers and started at the same time?

    Regards!

    1.    elav said

      Some people use Apache as a web server and NGnix as a proxy for web requests. Quite a mess. For example when using Node.js, which uses a port from the back that nobody uses and possibly your ISP has it blocked 😀

  5.   eliotime3000 said

    Good migration tutor. Also, Slackware long ago migrated to MariaDB to avoid further mess with MySQL.

    As soon as it's on the Debian backport security repo, I'll announce it as soon as possible. For now I am putting together my tutorial about installing / configuring / customizing Slackware.

  6.   jlbaena said

    But does kde still depend on mysql (on debian) or with this migration it is no longer necessary?

  7.   brunocascio said

    So from what I understood, every application configured with mysql would not have to reconfigure anything of it? Just install MariaDB (and uninstall mysql) and keeping the names as mysql should work?

    Regarding performance, engine changes are mentioned.
    Do they perform outstandingly with the old MylSam and InnoDB?

    Someone performed any metrics?

      1.    brunocascio said

        I understood haha, Thank you!

  8.   helena_ryuu said

    Thanks a lot! now if it is clear to me; D

  9.   Javier said

    Unable to set password for the MariaDB "root" user

    │ An error occurred while setting the password for the MariaDB │
    │ administrative user. This may have happened because the account already │
    │ has a password, or because of a communication problem with the MariaDB │
    │ server. │
    │ │
    │ You should check the account's password after the package installation. │
    │ │
    │ Please read the /usr/share/doc/mariadb-server-10.1/README.Debian file │
    │ for more information.

    1.    Javier said

      I uninstalled the mariadb maridb-server packages
      I removed the directory / var / lib / mysql.
      3 Reinstalled the Mariadb, Mariadb-server packages.
      systemct start mariadb; systemctl enable mariadb (problem solved).