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

column count of mysql.user is wrong please use mysql_upgrade to fix this error
mysql_upgrade: command not found
upgrade syntax in mysql
mysql upgrade logs
mysql upgrade command linux
error dropping database (can't rmdir
how long does mysql upgrade take
mysql_upgrade xampp mac

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 mysql.proc is wrong. Expected 20, found 16.

The table is probably corrupted.

Is there any solution for this?

<?php
$username="usrname";
$password="passwd";
$database="a1xxxxx_mydb";
$host="mysqlxx.000webhost.com";
mysql_connect($host,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
if (isset($_GET["userLatitude"]) && isset($_GET["userLongitude"])) {

 $userLatitude=$_GET['userLatitude']; 
 $userLongitude=$_GET['userLongitude']; 
 $result = mysql_query("SELECT locationName, ( 6371 * acos( cos( radians(floatval(     $userLatitude) )) * cos( radians( locationLatitude ) ) * cos( radians( locationLongitude ) - radians( floatval($userLatitude)) ) + sin( radians(floatval($userLongitude)) ) * sin( radians( locationLatitude) ) ) ) AS distance 
         FROM Location HAVING distance < 2 ORDER BY distance LIMIT 0 ,20") or die(mysql_error()); 
echo $result;

 // check for empty result
if (mysql_num_rows($result) > 0) {
   // looping through all results
   // products node
  $response["Location"] = array();

  while ($row = mysql_fetch_array($result)) {
    // temp user array
    $product = array();
    $product["locationName"] = $row["locationName"];
    $product["locationInfo"] = $row["locationInfo"];
    $product["locationLatitude"] = $row["locationLatitude"];
    $product["locationLongitude"] = $row["locationLongitude"];
    $product["locationPic"] = $row["locationPic"];
    $product["city"] = $row["city"];

    // push single product into final response array
    array_push($response["Location"], $product);
 }
 // success
 $response["success"] = 1;

   // echoing JSON response
   echo json_encode($response);
 } else {
// no products found
$response["success"] = 0;
$response["message"] = "No products found";

// echo no users JSON
echo json_encode($response);
 }
 }
  else {
    // required field is missing
   $response["success"] = 0;
   $response["message"] = "Required field(s) is missing";

  // echoing JSON response
  echo json_encode($response);
 }
mysql_close();
?>

I had this error as well. I fixed it by running

mysql_upgrade -u root -p

Also, restart the mysql service by running

service mysqld restart

MySQL Problem: Column count of mysql.proc is wrong. Expected 20 , Expected 20, found 16. The table is probably corrupted;. I was dumping and importing MySQL databases between my production server which  MySQL Problem: Column count of mysql.proc is wrong. Expected 20, found 16. The table is probably corrupted What is mysql.proc used for? mysql.proc system table is used to store procedures and stored functions. It’s pretty similar to the data you will find on INFORMATION SCHEMA.ROUTINES table. Why is my mysql.proc table corrupted?

This error happens when a bad upgrade is done. For example, it happens if you upgrade from 5.0 to 5.1 but don't run the mysql_upgrade script; or, in rare cases, it probably happens if you directly upgrade from 5.0 to 5.5. (Many people does this, but such updrages are not officially supported) You say you are using a hosting service - well, I think that you should create a ticket and tell them about the problem. If you don't have the SUPER privilege, there is nothing you can do. But if you have that right, simply run mysql_upgrade: http://dev.mysql.com/doc/refman/5.1/en/mysql-upgrade.html

SQL error (1547): Column count of mysql.proc is wrong, Expected 20, found 16. The table is probably corrupted. So would like to know what would be the probable cause and how to solve/rectify it. Thanks. The table is probably corrupted; The migration used a “mysqldump –all-databases” so it included the “mysql” database. Apparently the “mysql.proc” table changed between the versions.

I had the same problem when I updated XAMPP from xampp-osx-7.2.10 to 7.3.9 in MacOS Mohave. So the solution was:

Find the file mysql_upgrade in "Macintosh HD⁩ ▸ ⁨Applications⁩ ▸ ⁨XAMPP⁩ ▸ ⁨xamppfiles⁩ ▸ ⁨bin⁩" and double click on it.

SQL error (1547): Column count of mysql.proc is wrong, Expected 20, found 16. The table is probably corrupted. So would like to know what would be the probable cause and how to solve/rectify it. I  Teams. Q&A for Work. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.

I had the same problem when I updated the mysql server from 5.5 to 5.7 in Debian 8 (jessie). In my case, it worked fine when I executed the follow command:

mysql_upgrade --force -uroot -p

Hope it will help you

MySQL error in Plesk for Linux: Column count of mysql.user is wrong , ERROR 1558 (HY000) at line 67: Column count of mysql.proc is wrong. Expected 20, found 16. Created with The table is probably corrupted. After and upgrade I had "Column count of mysql.user is wrong. Expected 45, found 46. The table is probably corrupted" I was having trouble logging in so i fired up the db: mysqld --console --skip-grant-tables logged in and there was an extra column compared to my default table "Is_role" so i removed it: ALTER TABLE `user` DROP COLUMN `is_role`;

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

MySQL Error: Column count of mysql.proc is wrong. Expected 20 , MySQL Error: Column count of mysql.proc is wrong. Expected 20, found 16. The table is probably corrupted;. By admin on April 25, 2014 in MySQL. Encountered​  Phase 4/7: Running 'mysql_fix_privilege_tables' ERROR 1805 (HY000) at line 579: Column count of mysql.proc is wrong. Expected 20, found 21. The table is probably corrupted ERROR 1805 (HY000) at line 581: Column count of mysql.proc is wrong. Expected 20, found 21.

MYSQL error (1547): Column count of mysql.proc is wrong, simply showed me this error. MySQL Problem: Column count of mysql.proc is wrong. Expected 20, found 16. The table is probably corrupted  Expected 20, found 16. The table is probably corrupted This is because it first dumped the 5.1 mysql.proc table (20 columns) and reloaded the 16-column mysql.proc table (16 columns) and mysql 5.1 expects 20 columns.

ERROR 1805 (HY000): Column count of mysql.proc is wrong , ERROR 1805 (HY000): Column count of mysql.proc is wrong. Thread starter Expected 20, found 21. The table is probably corrupted ERROR 1805 (HY000) at line 581: Column count of mysql.proc is wrong. May 16, 2019. === Original errorlog when first starting the new server (priv tables not upgraded of course) 061218 13:38:20 [ERROR] Column count of mysql.db is wrong. Expected 22, found 20. Table probably corrupted 061218 13:38:20 [ERROR] (db) Expected field Event_priv at position 20 to have type enum('N','Y') but no field found.

[MDEV-14573] Upgrade from previous versions is broken for , ERROR 1805 (HY000) at line 574: Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted. ERROR 1805 

Comments
  • providing some more details would be a good start. Are you running a stored procedure? UDF? How about showing some of the code you're trying to run? We're good, but we're not psychic and cannot read your mind or remotely view your screen.
  • oh you are right , i am putting the code as fast as possible .I just can't connect to the 000webhost.com.I will post it. Thank you :)
  • dba.stackexchange.com/questions/956/…
  • I am using the phpMyAdmin which the website provides me with ...
  • Your script is vulnerable to SQL injections.
  • tnx much , you saved The day!
  • Yup. Fixed it. Who'da thunk it?
  • You might need the --force flag.
  • Just a small note. I had to run with sudo, ie sudo mysql_upgrade -uxxx -pxxx. otherwise we have this error: Could not create the upgrade info file '/var/lib/mysql/mysql_upgrade_info' in the MariaDB Servers datadir, errno: 13
  • @zwitterion 's tips helped, thanks!
  • Running mysql_upgrade -u root -p fixed my database for me. Thanks.
  • i tried to run it by double clicking, but i get "cannot execute binary file"..
  • works for me. Thanks a lot.
  • always format with code, using ctrl+k if you have wrote some code.
  • "know your data": true, but mysql.proc is not our data (and it took me hours, too many, to notice that...)