mysql.proc 的列数错误.预期为 20,发现为 16.该表可能已损坏 [英] Column count of mysql.proc is wrong. Expected 20, found 16. The table is probably corrupted
本文介绍了mysql.proc 的列数错误.预期为 20,发现为 16.该表可能已损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 000webhost.com,我在那里使用 phpMyAdmin.当我运行 PHP 脚本时,我从 MySQL 收到此错误,如标题所示:
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:
mysql.proc 的列数错误.预计 20 个,发现 16 个.
Column count of mysql.proc is wrong. Expected 20, found 16.
表可能已损坏.
有什么解决办法吗?
<?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
另外,通过运行
service mysqld restart
这篇关于mysql.proc 的列数错误.预期为 20,发现为 16.该表可能已损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文