17

ERROR 3554 (HY000) at line 318: Access to system table 'mysql.innodb_index_stats' is rejected.

Operation failed with exitcode 1 11:27:20 Import of C:\Users\VELOXSHOP\Downloads\dumpfilename.sql has finished with 1 errors

How do I allow acess to that table?

Baitalon
  • 181
  • 1
  • 1
  • 7

5 Answers5

20

You'll need to make a new dump/backup of your old database, this time remove those innodb tables from your target. You can do this by using --ignore-table parameter on the command line:

mysqldump -u root -p --all-databases --ignore-table=mysql.innodb_index_stats --ignore-table=mysql.innodb_table_stats > dump.sql

Then you should be able to restore your backup on the new database using the command below:

mysql -u root -p < dump.sql
Pedro Alvares
  • 479
  • 5
  • 9
12

You can also circumvent this error using the --force option which causes mysql client to continue despite errors.

Prazlin
  • 181
  • 2
  • 3
  • 3
    This is probably best as my old database is corrupted and don't have access - aka why I'm restoring a backup. – User Sep 01 '21 at 14:46
7

Try to add -f to your command like so:

mysql -u root -p -f < dump.sql

-f means --force.

This did the trick for me!

Vladimir Vs
  • 1,242
  • 13
  • 12
2

It seems to be restricted in Mysql 8. Remove the insert statement from the sql file. You may have to use sed if the file is very large

https://stackoverflow.com/a/26379517/1106420

https://bugs.mysql.com/bug.php?id=92675

frazras
  • 5,928
  • 4
  • 30
  • 40
0

That is a MySQL system table and it's unlikely that you should be inserting records into it directly. MySQL should update the table when it calculates new statistics for indexes when thresholds pass.

Inspect line 318 and figure out why it's trying to insert into that table.

Kevin Bott
  • 723
  • 3
  • 7