Column count of mysql.proc is wrong. Expected 20, found 16. The table is probably corrupted

后端 未结 8 498
灰色年华
灰色年华 2020-11-28 09:51

I am using 000webhost.com and I am using phpMyAdmin there. I am getting this error from MySQL when I run my PHP script as the title says:

Column count of

相关标签:
8条回答
  • 2020-11-28 10:33

    I was using a windows 10 system and the solution that worked for me was mysql_upgrade -u root -p

    But you need to ensure that the path to the mysql_upgrade script which is present in the mysql/bin folder of your installation directory needs to be added in the environment variable path for this command to work

    0 讨论(0)
  • 2020-11-28 10:34

    Although you may be correct about the necessity for upgrade, that's not the only reason this error occurs.

    When the following is called with a query that returns 1 row

     my $rv = $sth_indexq->fetchall_arrayref;
    

    the following error is reported:

    DBD::mysql::st execute failed: Column count of mysql.proc is wrong. Expected 20, found 16. Created with MySQL 50520, now running 50528. Please use mysql_upgrade to fix this error. at 
    ...
    

    However, the real cause of the error was use of fetchall_arrayref instead of fetchrow_arrayref. The following worked without errors:

    my $rv = $sth_indexq->fetchrow_arrayref;
    

    The data in $rv was only 1 level deep, not 2.

    The mysql_upgrade solution may very well solve this issue, but the simple solution is know your data and use the right retrieval code.

    J.White

    0 讨论(0)
提交回复
热议问题