Now, the mysql version is 5.1.I plan to move to mariadb 10.2.Use mysqldump and source to update databases.
Based on MySQL Upgrade Strategies,

Upgrading to the latest release is recommended before upgrading to the next version

Way 1:mysql 5.1->mysql 5.7->mariadb 10.2
Way 2:mysql 5.1->mariadb 5.1->mariadb 10.2
Which way is better(less data loss)?

  • Better according to what criteria? Why don't you go to MariaDB 10.2 in one step?
    – mustaccio
    Apr 21, 2018 at 15:22
  • Take a dump of your 5.1 and try and restore it into MariaDB 10.2 and if that fails (unlikely IMHO) use the other route. You'll still have your dump whatever happens!
    – Vérace
    Apr 21, 2018 at 15:30
  • 1
    Agreed that you can probably go directly from MySQL 5.1 to MariaDB 10.2 with a sql dump file. Maybe don't use the source command to import the dump if it's a big database as it prints the results of each statement to the terminal, so might be slow. Instead, if you're on Linux/Unix, run something like this from the Linux/Unix shell: mysql name_of_database < dumpfile.sql > import.log
    – dbdemon
    Apr 21, 2018 at 17:42
  • @Vérace, based on mysql upgrade strategies, Upgrading to the latest release is recommended before upgrading to the next version
    – kittygirl
    Apr 22, 2018 at 1:56
  • Back up, try it, if it fails come back. Apr 22, 2018 at 2:15

2 Answers 2


We can't do anything without a problem except point you to the official information,

Generally the further you are from an original fork the more complexities you'll encounter in the migration. Therefore the earlier the version of MySQL the fewer features of MySQL that are MySQL-specific that you'll have to contend with. Upgrading to a newer of MySQL before the migration to MariaDB is likely to make your job harder.


It's very probable that next sequence would be way more fast and painless comparatively to the software upgrading:

  1. mysqldump all the databases
  2. export all accounts with permissions
  3. deinstall mysql
  4. install mariadb
  5. import databases and accounts

Not the answer you're looking for? Browse other questions tagged or ask your own question.