Bug #29805 mysql_upgrade test fail if ~/.my.cnf contain a password
Submitted: 15 Jul 2007 6:15 Modified: 4 Sep 2007 18:03
Reporter: Remi Collet (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Tests Severity:S3 (Non-critical)
Version:5.0.45 OS:Linux (Fedora)
Assigned to: Magnus BlÄudd CPU Architecture:Any
Tags: testsuite mysql_upgrade

[15 Jul 2007 6:15] Remi Collet
Description:
If ~/.my.cnf provides a default password for client application the "mysql_upgrade" test fail (this is the only test to fail in this context).

$ cat mysql-test/r/mysql_upgrade.log 
Run mysql_upgrade once
/tmp/mysql-5.0.45/client/.libs/mysqlcheck: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect
FATAL ERROR: Upgrade failed
exec of '/tmp/mysql-5.0.45/client/mysql_upgrade --no-defaults --user=root --port=9306 --socket=/tmp/mysql-5.0.45/mysql-test/var/tmp/master.sock --datadir=/tmp/mysql-5.0.45/mysql-test/var/master-data --basedir=/tmp/mysql-5.0.45 --skip-verbose 2>&1 failed, error: 256, status: 1, errno: 0

How to repeat:
create ~/.my.cnf with, for exemple
[client]
user=root
password=secret

cd mysql-5.0.45/mysql-test
perl mysql-test-run.pl mysql_upgrade

Suggested fix:
Here is a litle patch to avoid this :
--- mysql-test/t/mysql_upgrade.test.orig	2007-07-04 15:49:09.000000000 +0200
+++ mysql-test/t/mysql_upgrade.test	2007-07-14 20:14:57.000000000 +0200
@@ -12,7 +12,7 @@
 # expected binaries it uses.
 #
 --echo Run mysql_upgrade once
---exec $MYSQL_UPGRADE --skip-verbose 2>&1
+--exec $MYSQL_UPGRADE --skip-verbose --password= 2>&1
 
 # It should have created a file in the MySQL Servers datadir
 file_exists $MYSQLTEST_VARDIR/master-data/mysql_upgrade_info;
@@ -20,13 +20,13 @@
 --echo Run it again - should say already completed
 --replace_result $MYSQL_SERVER_VERSION VERSION
 --error 1
---exec $MYSQL_UPGRADE --skip-verbose 2>&1
+--exec $MYSQL_UPGRADE --skip-verbose --password= 2>&1
 
 # It should have created a file in the MySQL Servers datadir
 file_exists $MYSQLTEST_VARDIR/master-data/mysql_upgrade_info;
 
 --echo Force should run it regardless of wether it's been run before
---exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
+--exec $MYSQL_UPGRADE --skip-verbose --force --password= 2>&1
 
 # It should have created a file in the MySQL Servers datadir
 file_exists $MYSQLTEST_VARDIR/master-data/mysql_upgrade_info;
@@ -54,7 +54,7 @@
 --replace_result $MYSQLTEST_VARDIR var
 --replace_regex /.*mysqlcheck.*: Got/mysqlcheck: Got/ /\([0-9]*\)/(errno)/
 --error 1
---exec $MYSQL_UPGRADE --skip-verbose --force --host=not_existing_host 2>&1
+--exec $MYSQL_UPGRADE --skip-verbose --force --host=not_existing_host  2>&1
 
 #
 # Bug #28401 mysql_upgrade Failed with STRICT_ALL_TABLES, ANSI_QUOTES and NO_ZERO_DATE
@@ -66,5 +66,5 @@
 
 # Test by setting sql_mode before running mysql_upgrade
 set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE';
---exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
+--exec $MYSQL_UPGRADE --skip-verbose --force --password= 2>&1
 eval set GLOBAL sql_mode=default;
[16 Jul 2007 8:09] Sveta Smirnova
Thank you for the report.

Verified as described.
[27 Aug 2007 9:32] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33135

ChangeSet@1.2502, 2007-08-27 11:31:49+02:00, msvensson@pilot.(none) +1 -0
  Bug#29805 mysql_upgrade test fail if ~/.my.cnf contain a password
   - "mysql" and "mysqlcheck" should not read defaults file
[4 Sep 2007 17:12] Bugs System
Pushed into 5.1.23-beta
[4 Sep 2007 17:13] Bugs System
Pushed into 5.0.50
[4 Sep 2007 18:03] Paul Dubois
Test suite change. No changelog entry needed.