I was restoring the backup of a MySQL 5.x server into MySQL 8.x server – and found out that it corrupt the MySQL 8.x ‘s mysql table
Which stores the usernames and passwords.
So I had to delete the mysql table from the backup, before trying to restore it again
Turn out it’s pretty easy, just will take some time since it’s a pretty big backup :
# search for beginning of 'mysql' table cat backup.mysql | grep -n Current Database: `mysql` # 155604:-- Current Database: `mysql` # search for ending of 'mysql' table tail -n +155604 backup.mysql | grep -n "Current Database" # 1: -- Current Database: `mysql` # 916:-- Current Database: `phpmyadmin` # cut that table out head -155603 backup.mysql > new.mysql tail -n +$(( 155603+916 )) backup.mysql >> new.mysql # voila !