[PHP][PEAR] Solution for 'Column count of mysql.proc is wrong.' Error
When I issued an UPDATE statement using PEAR::DB in PHP, a “DB Error: unknown error” occurred.
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:
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.
That’s all from the Gemba.