Mysql Daemon cannot start after upgrade from 5.1 to Mysql 8

MySQLmysql-5.1mysql-8.0

I preinstalled Oracle Enteprise Linux and it automatically installed Mysql Community 5.1. But I wanna update it to 8.
After update the daemon won't start and the /var/log/mysqld.log shows that

[ERROR] [MY-012263] [InnoDB] The Auto-extending innodb_system data file './ibdata1' is of a different size 640 pages (rounded down to MB) than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages!

Then I change the /etc/my.cnf file and add

innodb_data_file_path = ibdata1:10M:autoextend

I tried to start it again and the log file said

[ERROR] [InnoDB] Unsupported redo log format (0). The redo log was created before MySQL 5.7.9

because if that, I moved the /var/lib/mysql/ib_logfile* to backup directory and try to start mysqld again.
BUT it still won't start because the log file said

[ERROR] [MY-012960] [InnoDB] Cannot create log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
[ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
[ERROR] [MY-011013] [Server] Failed to initialize DD Storage Engine.
[ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
[ERROR] [MY-010119] [Server] Aborting

Any help would be appreciated.

Best Answer

That is a gynormous upgrade.

Plan A: Oracle recommends doing it in 4 steps 5.1 -> 5.5 -> 5.6 -> 5.7 -> 8.0. And, at each step, run mysql_upgrade.

Plan B: Alternatively, you could dump the data and hope that the reload doesn't find some syntax errors.

I fear that you may have already hosed the files too much to have a successful upgrade.