[PHP][PEAR] Solution for 'Column count of mysql.proc is wrong.' Error
Tadashi Shigeoka · Mon, October 10, 2011
When I issued an UPDATE statement using PEAR::DB in PHP, a “DB Error: unknown error” occurred.
Error Content with getMessage()
DB Error: unknown error
This error content provides no clues, so I tried getting more detailed error information with getDebugInfo().
- getMessage() : DB Error: unknown error
- getDebugInfo() : INSERT INTO table_name (column1,column2,column3) VALUES(value1,value2,value3) [nativecode=1364 ** Field 'column4' doesn't have a default value]
When I got the error with getDebugInfo(), my error was as follows:
Error Content with getDebugInfo()
UPDATE users SET friend_num = 1 WHERE (id=45)
[nativecode=1558 ** Column count of mysql.proc is wrong.
Expected 20, found 16.
Created with MySQL 50077, now running 50152.
Please use mysql_upgrade to fix this error.]
When I searched for Column count of mysql.proc is wrong., it said running mysql_upgrade would solve it, but in my case, it was because there were parts in the SQL statement that didn’t include half-width spaces.
That’s all.
Reference Information
- 葛藤・悶絶なる日々 MySQLで突然、Column count of mysql.proc is wrong. Expected 20, found 16.がでたら (Days of Struggle and Agony - If MySQL Suddenly Shows "Column count of mysql.proc is wrong. Expected 20, found 16.")
- MySQL :: MySQL 5.6 リファレンスマニュアル :: 4.4.7 mysql_upgrade — MySQL テーブルのチェックとアップグレード (MySQL :: MySQL 5.6 Reference Manual :: 4.4.7 mysql_upgrade — Check and Upgrade MySQL Tables)
That’s all from the Gemba.