Ticket #10566 (new defect)
mysql5 mysql_upgrade doesn't work after upgrading to 5.0.24
| Reported by: | ryandesign@… | Owned by: | ryandesign@… |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | ports | Version: | 1.3.2 |
| Keywords: | Cc: | jberry@…, markd@… | |
| Port: | mysql5, mysql5-devel |
Description (last modified by ryandesign@…) (diff)
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
comment:3 Changed 7 years ago by jberry@…
- Status changed from new to assigned
- Description modified (diff)
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 7 years ago by jberry@…
- Status changed from assigned to closed
- Resolution set to worksforme
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 7 years ago by ryandesign@…
- Status changed from closed to reopened
- Version changed from 1.2 to 1.3.2
- Resolution worksforme deleted
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 7 years ago by jberry@…
Hey Ryan,
Yes, of course a patch would be appreciated. Sorry, I am really busy at the moment... James.
comment:8 Changed 6 years ago by ryandesign@…
- Owner changed from jberry@… to ryandesign@…
- Status changed from reopened to new
- Milestone set to Port Bugs
my bug now :)


Did 5.2.4a fix this?