Bug #24272 mysql_upgrade doesn't honor the datadir and basedir variables.
Submitted: 13 Nov 2006 18:14 Modified: 8 Jan 2007 13:25
Reporter: Tobias Asplund Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.1.12 OS:MacOS (Mac OS X)
Assigned to: Assigned Account CPU Architecture:Any

[13 Nov 2006 18:14] Tobias Asplund
Description:
mysql_upgrade script seems to ignore the directories submitted as datadir and basedir.

See below where I try to modify the installation with the datadir /var/mysql, after running on all those tables we see that it's actually running on the data in /usr/local/mysql/data instead of what I supply as datadir (/var/mysql ).

And it's not a relative path, because ./data is not /usr/local/mysql/data (see below).

Potential duplicate of Bug #18156 but seems to not honor datadir instead of basedir as in the other report.

How to repeat:
ustr-pavithk:/usr/local/mysql-5.1.12-beta-osx10.4-i686 root# ./bin/mysql_upgrade --datadir=/var/mysql --basedir=/usr/local/mysql5.1 --force
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.func                                         OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.host                                         OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK
mysql.user_info                                    OK
sakila.actor                                       OK
sakila.address                                     OK
sakila.category                                    OK
sakila.city                                        OK
sakila.country                                     OK
sakila.customer                                    OK
sakila.film                                        OK
sakila.film_actor                                  OK
sakila.film_category                               OK
sakila.film_text                                   OK
sakila.inventory                                   OK
sakila.language                                    OK
sakila.payment                                     OK
sakila.rental                                      OK
sakila.staff                                       OK
sakila.store                                       OK
skup0003_.alts                                     OK
skup0003_.attendance                               OK
skup0003_.blah                                     OK
skup0003_.comments                                 OK
skup0003_.continents                               OK
skup0003_.doubledrops                              OK
skup0003_.dungeons                                 OK
skup0003_.expansions                               OK
skup0003_.expref                                   OK
skup0003_.flw                                      OK
skup0003_.itemlinks                                OK
skup0003_.log                                      OK
skup0003_.loot                                     OK
skup0003_.looted_items                             OK
skup0003_.members                                  OK
skup0003_.mobs                                     OK
skup0003_.news                                     OK
skup0003_.page_access                              OK
skup0003_.page_hits                                OK
skup0003_.page_time                                OK
skup0003_.pages                                    OK
skup0003_.quotes                                   OK
skup0003_.raids                                    OK
skup0003_.referer                                  OK
skup0003_.schedule                                 OK
skup0003_.seen                                     OK
skup0003_.sessions                                 OK
skup0003_.spelldata                                OK
skup0003_.static_fields                            OK
skup0003_.user_schedule                            OK
skup0003_.users                                    OK
test.ai                                            OK
test.art                                           OK
test.bh                                            OK
test.dt                                            OK
test.emp_x_proj                                    OK
test.employees                                     OK
test.f                                             OK
test.nl                                            OK
test.phoneno                                       OK
test.projects                                      OK
test.re                                            OK
test.sessions                                      OK
test.t1                                            OK
test.t11                                           OK
test.t2                                            OK
test.t3                                            OK
test.t4                                            OK
test.trg                                           OK
user_data.secret                                   OK
world.city                                         OK
world.city_memory                                  OK
world.continents2                                  OK
world.country                                      OK
world.countrylanguage                              OK
world.am                                           OK
world.na                                           OK
world.sa                                           OK
world.t1                                           OK
world.t5                                           OK
world.t6                                           OK
world.t7                                           OK
world.t8                                           OK
world2.city                                        OK
ERROR 1060 (42S21) at line 28: Duplicate column name 'File_priv'
ustr-pavithk:/usr/local/mysql-5.1.12-beta-osx10.4-i686 root# ls -la /var/mysql
total 8
drwxr-xr-x    6 mysql  admin   204 Nov 13 11:40 .
drwxr-xr-x   25 root   wheel   850 Nov 10 02:11 ..
drwx------    6 root   admin   204 Nov 13 11:39 cluster
drwx------   56 root   admin  1904 Nov 13 11:39 mysql
-rw-r-----    1 root   admin    11 Nov 13 11:41 mysql_upgrade_info
drwx------    2 root   admin    68 Nov 13 11:31 test
ustr-pavithk:/usr/local/mysql-5.1.12-beta-osx10.4-i686 root# 

ustr-pavithk:/usr/local/mysql-5.1.12-beta-osx10.4-i686 root# ls /usr/local/mysql/data/
blah                    ib_logfile1             sakila                  user_data
flupps.local.pid        ibdata1                 skup0003_               world
ib_logfile0             mysql                   test                    world2
ustr-pavithk:/usr/local/mysql-5.1.12-beta-osx10.4-i686 root# ls ./data                
mysql   test
[14 Nov 2006 11:03] Valeriy Kravchuk
Thank you for a problem report. Please, specify what exact result is a problem in your case. I tried to repeat with 5.1.13-BK on Linux, and, as in your case, I've got mysql_upgrade_info file in the --datadir specified. While I had not got any ./data subdirectory in --basedir.
[14 Nov 2006 13:36] Tobias Asplund
ok, let me try to rephrase the problem.

I have an installation in /usr/local/mysql5.0 and one in /usr/local/mysql5.1
The data for the 5.0 installation is in /usr/local/mysql5.0/data.
The data for the 5.1 installation is in /var/mysql
There is also a symlink from /usr/local/mysql -> /usr/local/mysql5.0

from /usr/local/mysql5.1 I run mysql_upgrade with the --datadir=/var/mysql and the --basedir=/usr/local/mysql5.1

I do get a mysql_upgrade.info file in /var/mysql, but the tables it actually upgrades are in /usr/local/mysql5.0.
So, this tells us two things:
1. It's not using the directory specified by --datadir for anything except the mysql_upgrade.info file
2. It's not using ./data as a default path to change tables.
3. It seems to use /usr/local/mysql/data hard coded.

What I'm showing in my case is that despite the whole list of tables it says it updated, there's actually nothing in the directory I set as a --datadir.
[8 Dec 2006 13:49] Sveta Smirnova
Thank you for the report.

I can not repeat it on Intel Mac using today BK sources with mysql 5.0 and 5.1 both installed in my HOME directory. Please try using current BK sources and say result.
[9 Jan 2007 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".