Some releases of MySQL introduce changes to the structure of
the system tables in the mysql database
to add new privileges or support new features. When you
update to a new version of MySQL, you should update your
system tables as well to make sure that their structure is
up to date. Otherwise, there might be capabilities that you
cannot take advantage of. First, make a backup of your
mysql database, and then use the
following procedure.
On Unix or Unix-like systems, update the system tables by running the mysql_fix_privilege_tables script:
shell> mysql_fix_privilege_tables
You must run this script while the server is running. It
attempts to connect to the server running on the local host
as root. If your root
account requires a password, indicate the password on the
command line. For MySQL 4.1 and up, specify the password
like this:
shell> mysql_fix_privilege_tables --password=root_password
Prior to MySQL 4.1, specify the password like this:
shell> mysql_fix_privilege_tables root_password
The mysql_fix_privilege_tables script
performs any actions necessary to convert your system tables
to the current format. You might see some Duplicate
column name warnings as it runs; you can ignore
them.
After running the script, stop the server and restart it.
On Windows systems, there isn't an easy way to update the
system tables until MySQL 4.0.15. From version 4.0.15 on,
MySQL distributions include a
mysql_fix_privilege_tables.sql SQL
script that you can run using the mysql
client. For example, if your MySQL installation is located
at C:\Program Files\MySQL\MySQL Server
4.1, the commands look like this:
C:\>cd "C:\Program Files\MySQL\MySQL Server 4.1"C:\>bin\mysql -u root -p mysqlmysql>SOURCE scripts/mysql_fix_privilege_tables.sql
The mysql command will prompt you for the
root password; enter it when prompted.
If your installation is located in some other directory, adjust the pathnames appropriately.
As with the Unix procedure, you might see some
Duplicate column name warnings as
mysql processes the statements in the
mysql_fix_privilege_tables.sql script;
you can ignore them.
After running the script, stop the server and restart it.

User Comments
Please notice that you cannot just run the newest version of the mysql_fix_privilege_tables.sql and assume that all is good! If you come from a version of MySQL with a major version number lower than 5 (for example 4.10) you MUST first upgrade via the older version MySQL 5.0.1 before you can upgrade with the newest version MySQL 5.x.
If you already did an upgrade without the first step (as I did - I jumped from ver. 4.1.10a-nt to ver. 5.0.16) then you can expect troubles from MySQL Administrator, claiming that it cannot find the column Create_view_priv. To fix that, I downloaded the MySQL version 5.0.1 and ran the mysql_fix_privilege_tables.sql script from that version, then again ran the script from the newest version. It seems to work!
I did a straight upgrade on Windows from 4.1.12a to 5.0.18-nt and found that you could do the following:
- run the mysql_fix_privilege_tables.sql file (errors reported)
- stop the server, and start it again
- run the scripts/mysql_fix_privilege_tables.sql again
- stop the server, and start it again
This seemed to then work fine. MySql Administrator happily allows you to create sprocs etc.
I've only been running for a few hours, but no problems so far.
-- Tobin Harris
A agree with the Tobin Harris repair help
I also have error no. 1054 after upgrade and the twice run mysql_fix_privilege_tables look like to resolve it.
Upgrade from vesion 4.1.9 to 5.0.21
Worked fine for me. Moved from 4.11 to 5.0.22 on Linux FC4.
Add your own comment.