20

After Fedora 28 decided to upgrade mysql-community packages to 8.0 (latest) ,I realized my application was failing and had to downgrade to mysql 5.27.2

Of course my db files (.idb) were the same (altered by mysql 8.0). When starting mysql 5.27 service, it fails. I have read the log file /var/log/mysqld.log and found this:

InnoDB: Table flags are 0 in the data dictionary but the flags in file ./ibdata1 are 0x4000!

2 Answers 2

27

This problem was solved removing all database files:

 sudo rm -rf /var/lib/mysql/*

Please be aware you will lose every database in the server by doing this!!! In my case I had a dump and i could restore.

8
  • The Upgrade Notes are clear -- you cannot go back to 5.7 without reloading the data !
    – Rick James
    Commented May 27, 2018 at 0:23
  • 1
    Do you really read the upgrade notes of every package updated in a complete OS release?
    – julianm
    Commented May 28, 2018 at 3:23
  • You are trying to Downgrade: "had to rollback to mysql 5.27.2".
    – Rick James
    Commented May 28, 2018 at 3:52
  • On a mac is it possible to use Time Machine to restore the contents of the mysql data folder? (It's a development machine not production! And just an ordinary laptop not a server).
    – Annabel
    Commented Jun 4, 2019 at 23:08
  • 3
    Wow. Genius solution </irony> Commented Nov 1, 2020 at 19:18
3

Ensure you are using the MySQL version 8.0 client specifically to avoid this error

RCA 1.You attempted to start a newer version of mysql server with mysqld_safe(ver5) instead of the version 8.0

Solution

export MYSQL_8_HOME=/path/to/mysql-8.0.17-macos10.14-x86_64 #e.g /usr/local/mysql-8.0.17-macos10.14-x86_64
cd $MYSQL_8_HOME # where is the dorectory mysql v8.0 was installed.
bin/mysqld_safe --user=mysql --datadir=/path/to/data/mysql 

Just for added measure, you might consider updating your PATH variable to prefix it with the newer version of MySQL programs like this

export PATH=$MYSQL_HOME/bin:$PATH

before starting mysqld_safe

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