I mistyped the name of an internal MySQL function in some code this morning and got back the error message "Cannot load from mysql.proc. The table is probably corrupted" which appeared to have no bearing on the actual error. The simple fix to this problem is to run the mysql_upgrade command.
mysql_upgrade
From the command line (you won't be able to do this from a tool like phpMyAdmin) run the command line tool mysql_upgrade passing like so:
Then enter the root's password and it will check all the databases and tables and fix them where appropriate. You may need to specify the full path to the above command if it's not in the shell's search path.
On Debian 6 it's at /usr/bin/mysql_upgrade
On Mac MAMP /Applications/MAMP/Library/bin/mysql_upgrade
On Windows it'll be where-ever MySQL is installed in the bin subdirectory. You'll need to open up the command prompt, change to that directory and then run mysql_upgrade.exe -u root -p
Now that I'd upgraded the databases I got a much better error message which was related to the error I'd created: "FUNCTION [dbname].[function name] does not exist"
Disclaimer
Before running a command like this on a production server, it's always a good idea to take a full backup of all databases first, just in case something goes wrong.
0 comments:
Post a Comment