Opened 18 years ago

Last modified 10 years ago

#10566 new defect

mysql5 mysql_upgrade doesn't work after upgrading to 5.0.24

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 1.3.2
Keywords: Cc: jberry@…
Port: mysql5, mysql5-devel

Description (last modified by ryandesign (Ryan Carsten Schmidt))

I understand you're supposed to run mysql_upgrade after you upgrade to a new version of MySQL. But after upgrading to MySQL 5.0.24, mysql_upgrade doesn't seem to work anymore.

(I have /opt/local/bin, /opt/local/sbin and /opt/local/lib/mysql5/bin in my PATH.)

$ mysql_upgrade5
Can't find program '/opt/local/bin/mysqlcheck'
Please restart with --basedir=mysql-install-directory
$ mysql_upgrade                    
Can't find program '/opt/local/bin/mysqlcheck'
Please restart with --basedir=mysql-install-directory
$ mysql_upgrade --basedir=/opt/local/lib/mysql5/
Can't find data directory. Please restart with --datadir=path-to-data-dir
$ mysql_upgrade --basedir=/opt/local/lib/mysql5/ --datadir=/Users/rschmidt/mysql/data/
[snipped usage message for mysqlcheck]
Could not find file mysql_fix_privilege_tables.sql
Please use --basedir to specify the directory where MySQL is installed
$

I don't know what to specify now. And it seems to me like I shouldn't have to specify anything -- that it should already know where its parts are. In 5.0.22 the script worked fine without specifying anything extra, but I read in the release notes that between 5.0.22 and 5.0.24 they rewrote mysql_upgrade and changed it from a shell script to a C program. I'm guessing that has something to do with this problem.

Change History (11)

comment:1 Changed 18 years ago by markd@…

Cc: jberry@… markd@… added

Did 5.2.4a fix this?

comment:2 Changed 18 years ago by markd@…

I mean 5.0.24a.

comment:3 Changed 18 years ago by jberry@…

Description: modified (diff)
Status: newassigned

Probably the upgrade scrip gets confused, because of the way in which we rename the mysql binaries with a 5 at the end. The script probably needs to get upgraded with these.

comment:4 Changed 18 years ago by jberry@…

Resolution: worksforme
Status: assignedclosed

You need to pass the "basedir" in a form that will make sense to mysql. Given the funky way in which we package mysql5, that is:

mysql_upgrade5 --basedir=/opt/local/lib/mysql5

comment:5 Changed 18 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: worksforme
Status: closedreopened
Version: 1.21.3.2

Re: jberry's suggestion that I should specify --basedir=/opt/local/lib/mysql5:

1) You will see in my original problem report that I already tried specifying exactly this, and that it did not work.

2) I do not want to have to specify anything at all. As I explained, in 5.0.22, I did not have to specify anything and the script worked fine.

I have now upgraded to mysql5 5.0.27, but the problem remains. I ran mysql_upgrade5 specifying --basedir=/opt/local/lib/mysql5 (and also --datadir=/path/to/data because I have moved it from the usual location) and also -p so it asks for my root password. This proceeds to check all my tables, which seems to work fine. Lots of output like this:

mysql.columns_priv                                 OK
mysql.db                                           OK
[snip]

However, once it has finished checking all my tables, it still says

Could not find file mysql_fix_privilege_tables.sql
Please use --basedir to specify the directory where MySQL is installed

And as I explained, I am already specifying the --basedir option. Perhaps mysql_upgrade expects mysql_fix_privilege_tables.sql to exist at a particular location relative to mysql_upgrade, and with MacPorts's install layout this relationship no longer holds?

In fact I think that's exactly it: starting at line 375 of client/mysql_upgrade.c: it looks for mysql_fix_privilege_tables.sql in the following subdirectories of the basedir: support_files, share, share/mysql, scripts, and finally in /usr/local/mysql/share/mysql, but of course none of these exist in the MacPorts hierarchy. Perhaps the best fix is to patch (or reinplace) that file so it knows about the location of the file within MacPorts. Do you have time to do this or should I see if I can work out a patch for you?

comment:6 Changed 18 years ago by jberry@…

Hey Ryan,

Yes, of course a patch would be appreciated. Sorry, I am really busy at the moment... James.

comment:7 Changed 18 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign@… added

comment:8 Changed 17 years ago by ryandesign (Ryan Carsten Schmidt)

Milestone: Port Bugs
Owner: changed from jberry@… to ryandesign@…
Status: reopenednew

my bug now :)

comment:9 Changed 16 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign@… removed
Description: modified (diff)
Port: mysql5 mysql5-devel added
Reporter: changed from opendarwin-2006@… to ryandesign@…

comment:10 Changed 16 years ago by (none)

Milestone: Port Bugs

Milestone Port Bugs deleted

comment:11 Changed 10 years ago by mf2k (Frank Schima)

Cc: markd@… removed
Note: See TracTickets for help on using tickets.