Search the MySQL manual:

2.5.2 Upgrading From Version 3.23 to 4.0

In general, you should do the following when upgrading to 4.0 from an earlier MySQL version:

MySQL 4.0 will work even if you don't do the above, but you will not be able to use the new security privileges that MySQL 4.0 and you may run into problems when upgrading later to MySQL 4.1 or newer. The ISAM file format still works in MySQL 4.0 but it's deprecated and will be disabled in MySQL 5.0.

Old clients should work with a Version 4.0 server without any problems.

Even if you do the above, you can still downgrade to MySQL 3.23.52 or newer if you run into problems with the MySQL 4.0 series. In this case, you must use mysqldump to dump any tables that use full-text indexes and reload the dump file into the 3.23 server. This is necessary because 4.0 uses a new format for full-text indexing.

The following is a more complete list that tells what you must watch out for when upgrading to version 4.0:

If you are running MySQL Server on Windows, please also see section 2.5.7 Upgrading MySQL under Windows. If you are using replication, please also see section 4.10.2 Replication Implementation Overview.

User Comments

Posted by Steve Johnson on Wednesday April 2 2003, @2:28pm[Delete] [Edit]

Steve,
I just upgraded without any prior research today with ease. I started by reading this page about an hour ago. Then upgraded my 2 production servers. The biggest hold-up was waiting for it to build. I believe they've done an awesome job. And sometimes it just makes more sense to omit old code for the sake of new code, it happens all the time, it's something hard to understand, unless you're worknig on it yourself. BTW, There is a commercial version of Mysql. And if you're having problems and you can't afford to have your server down, you should really look into MySql's support contract, or hire an outside consultant.

Posted by Toby Horton on Monday April 7 2003, @9:56am[Delete] [Edit]

Note to Win32 users planning to upgrade to 4.0:

There appears to be no allowance made for a Win compatible mysql_fix_privilege_tables script. Both mysql_fix_privilege_tables and mysql_fix_privilege_tables.sh are identical and are both shell scripts.

Posted by gogman on Monday April 7 2003, @12:45pm[Delete] [Edit]

Upgrading to 4.0 MySQL may not be possible if you run PHP, Perl or MyODBC.... At this time, most rpm's and packages have a dependency on libmysqlclient.so.10, instead of libmysqlclient.so or libmysqlclient.so.12. This does not occur in every case since the linkage process differs with different build strategies. If you have this difficulty may wish to file a bug "http://www.mysql.com/doc/en/Bug_reports.html report" as well as the particular 3rd party vendor/packager and request that the 3rd party upgrade thier package linkage for libmysqlclient.so. Any strategies for short term work arounds would be helpful.

Posted by [name withheld] on Sunday April 13 2003, @1:25am[Delete] [Edit]

Anybody have a "simple" way to upgrade the privileges for a newbie mySQL/Windows user?

the shell script doesn't help us much. Amazing that a mysql release left us out completely with such an important issue

Mood

Posted by Vladimir Bogdanov on Monday April 14 2003, @11:10pm[Delete] [Edit]

I guess I'll have to rewrite the mysql_fix_privilege_tables script in Perl so I could run it on my win32 box...

... or google it up?

Posted by Vladimir Bogdanov on Tuesday April 15 2003, @12:27am[Delete] [Edit]

As I couldn't find any perl version of the mysql_fix_privilege_tables script, I had to port to Perl myself. To spare your time, you may download the script from my server.

http://www.vladb.com/pub/mysql_fix_privilege_tables.tar

Posted by Melvin Hendrix on Tuesday April 29 2003, @1:02am[Delete] [Edit]

The file hack above did not work for me. The file runs without error, but does not fix the tables. The good news is that a perl-scripted mysql_fix_privilege_tables file is contained in the MySQL source distribution, although it's true that its not contained in the MySQL 4.0.x binary.

You can download the binary for ease of installation; then, download the source, extract the file and run it on your Windows OS system. If you are not using Perl on your system, you will need to download a package from www.perl.com or www.activestate.com.

Posted by Mário Filipe Pinhal on Thursday May 1 2003, @5:00am[Delete] [Edit]

PLz... i now this is a VERY STUPID and innocent question...

i Don't know how to run a script :(
i am upgrading from 3.23 to 4.0.12 @ Windows platform

I ve installed the 4.0.12 version, and all seems to be alright, but it tells me (and also in the web site) that i should tun the
mysql_fix_privilege_tables
script...
i 've located the file in mysql dir, but... my problem is i dont know how to run a script :/ :(
PLZ s1 hel me .. ,:(

PS: is it a SQL query? a PHP command? :(
my mail if anyone could help me :
mailto:mfpinhal@netcabo.pt
Tnhx anyway :)

Posted by [name withheld] on Thursday May 1 2003, @7:12am[Delete] [Edit]

You need to install perl to run that script. I don't have a windows installation of mysql but I imagine that it must be the same way. See the comment preceeding yours, that says:

"The good news is that a perl-scripted mysql_fix_privilege_tables..."

Posted by Eric Coffman on Monday May 5 2003, @4:57pm[Delete] [Edit]

Installing Perl, I suppose, would be an option to run the script. But, why do that for just this one purpose. It would be helpful if it could be done otherwise... a way that is native to Windows. Any chance of that?

Posted by Samuel Persson on Wednesday May 7 2003, @8:02am[Delete] [Edit]

You could run the script (talking win32 here) from the Cygwin shell if you have cygwin installed.
Created a slightly modified script for that.
[ http://sampe.ngstudios.tk/stuff/mysql_fix_privilege_tables.zip ]

To make it work you have to add the path as an argument, like this:
sh mysql_fix_privilege_tables <password> <path>

ex. (default MySQL installation)
sh mysql_fix_privilege_tables password /cygdrive/c/mysql/bin/mysql

Posted by [name withheld] on Monday May 12 2003, @7:35pm[Delete] [Edit]

What is the best way to upgrade the rpms on Redhat 7.3
with Mysql 3.23.56 already loaded ?

rpm -e all that it errors with or is there a better way ?
then do an rpm -ivh Mysql*.rpm

Posted by Aaron Gee on Tuesday May 13 2003, @12:55pm[Delete] [Edit]

Forth those of you with PHP and PERL DBD installed, you will have to recompile those packages. There are a few other packages that look for MySQL files that may need to be rebuilt. The easiest way in the RedHat world is to do the following.

D/L and install MySQL 4.0 via RPM to find out what packages bitch

rpm -Uvh mysql4....rpm

This will give you errors, write down each package that presents a dependancy error and then D/L the source RPM's for each package.

Then REALLY install the package

rpm -Uvh --nodeps mysql4....rpm

Install all the source RPM's you D/L ed above

rpm -ivh *.srpm

**Build each package by going to /usr/src/redhat/SPECS and then running

rpmbuild -ba package-name.spec

This will recompile the package, and put the new RPM in /usr/src/redhat/RPMS

You can the upgrade your rpm with

rpm -Uvh --force package-name.rpm

Go back to ** and repeat for each RPM SPEC file that you have.

Posted by Scott Haneda on Tuesday May 27 2003, @3:26pm[Delete] [Edit]

Well this is very interesting

At the start of the script they have
root_password="$1"
host="localhost"
user="root"

I added in just below the above
echo "----------------------------------------------------------"
echo $root_password
echo "----------------------------------------------------------"

Then if you try
sh mysql_fix_privilege_tables -p somepassword
Guess what you get...
----------------------------------------------------------
-p somepassword
----------------------------------------------------------

So it seems the script takes the whole argument...

sh mysql_fix_privilege_tables my_root_pass
Works fine

Is this standard behavior?
The Script says
echo "If you get 'Access denied' errors, you should run this script again"
echo "and give the MySQL root user password as an argument!"

Does not really tell you there is some special way to do it. What is the
heck is $1 anyway? And why is it a literally quoted value?

Posted by [name withheld] on Tuesday May 27 2003, @6:19pm[Delete] [Edit]

I am surprised that no one has put together a set of SQL statements instead of the fix script to make the upgrade easier and platform independent.

Posted by John Bunyan on Wednesday June 18 2003, @7:45am[Delete] [Edit]

i think you should have a "Complaints" Type for comments.

Posted by Kim Terp on Wednesday June 18 2003, @8:05am[Delete] [Edit]

Isn't the easiest way to upgrade this:

Make a dump of all databases.
Stop and uninstall server
Install new MySQL 4.0.x
Import all databases again
Start server

Or is there a problem with this method?

Posted by [name withheld] on Tuesday June 24 2003, @10:33am[Delete] [Edit]

@Kim Terp: Yes there is a problem with your method. You loose all the privileges and users that you have setup. You could also transfer the mysql databse which contains users and privileges but then you would have the same problem again.

Posted by Gus Heck on Monday August 4 2003, @8:14am[Delete] [Edit]

It seems the command to find out if you have ISAM tables and or MyISAM tables is SHOW TABLE STATUS;

Be nice if that had been mentioned above. I spent most of this morning trying to find that out. No one on IRC knew and it was a student here at our college who finally kenw the answer.

Posted by Daniel Convissor on Tuesday August 5 2003, @9:37am[Delete] [Edit]

The mysql_fix_privilege_tables script has several flaws. I've rectified them by turning it into a purely SQL script:

http://www.analysisandsolutions.com/code/mysql_fix_privilege_tables_323_to_40.sql

The problems with mysql_fix_privilege_tables is that it doesn't work if any of the following are true:
1) Computer uses Windows operating systems.
2) Have changed the name of their "root" user.
3) Have mysql instlalled in non-default locations.

Also, the case of several field names is incorrect.

Add your own comment.