Bug #20597 mysql_install_db fails when path to defaults-file includes ~ (tilde).
Submitted: 21 Jun 2006 9:56 Modified: 5 Oct 2006 16:42
Reporter: Tihomir Slavkov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:5.0.25-BK, 5.0.22 OS:unix, linux
Assigned to: Alexander Barkov CPU Architecture:Any

[21 Jun 2006 9:56] Tihomir Slavkov
Description:
mysql_install_db fails when used with --defaults-file option and path to defaults-file includes ~ (tilde) (for example /opt/test/~/conf/mysql.conf). The problem does not occur when path to defaults file does not include tilde character. 

shell:/mysql # sh ./scripts/mysql_install_db --defaults-file=/opt/test/~/conf/mysql.conf
Could not open required defaults file: /opt/test/~/conf/mysql.conf
Fatal error in defaults handling. Program aborted
Installing all prepared tables
Could not open required defaults file: /opt/test/~/conf/mysql.conf
Fatal error in defaults handling. Program aborted
Installation of system tables failed!

running script with -x shows:

+ eval './bin/mysqld --defaults-file=/opt/test/~/conf/mysql.conf  --bootstrap --skip-grant-tables --basedir=. --datadir=./data --skip-innodb --skip-bdb --skip-ndbcluster  --max_allowed_packet=8M --net                                                         _buffer_length=16K'
++ ./bin/mysqld --defaults-file=/opt/test/~/conf/mysql.conf --bootstrap --skip-grant-tables --basedir=. --datadir=./data --skip-innodb --skip-bdb --skip-ndbcluster --max_allowed_packet=8M --net_buffer                                                          _length=16K
Could not open required defaults file: /opt/test/~/conf/mysql.conf
Fatal error in defaults handling. Program aborted
+ echo 'Installation of system tables failed!'
Installation of system tables failed!

How to repeat:
When installing MySQL, try to execute mysql_install_db with --defaults-file option and path to defaults-file include ~.

shell:/mysql # sh ./scripts/mysql_install_db --defaults-file=/opt/test/~/conf/mysql.conf
Could not open required defaults file: /opt/test/~/conf/mysql.conf
Fatal error in defaults handling. Program aborted
Installing all prepared tables
Could not open required defaults file: /opt/test/~/conf/mysql.conf
Fatal error in defaults handling. Program aborted
Installation of system tables failed!

Suggested fix:
Tilde character should not be problem. Probably it needs to be escaped somwhere.
[19 Jul 2006 10:17] Valeriy Kravchuk
Thank you for a problem report. Sorry for a delay with processing.

Please, send the results of

ls -l /opt/test/~/conf/mysql.conf
[25 Jul 2006 7:45] Tihomir Slavkov
Hi and sorry for the delay. Please, find below the information you requested. Something I missed in my post is that the instalation is performed with root user.

John:/home/tiho/install # whoami
root
John:/home/tiho/install # ls -l /opt/test/~/conf/mysql.conf
-rw-r--r--  1 root root 1469 Jul 25 10:40 /opt/test/~/conf/mysql.conf
John:/home/tiho/install #
[30 Aug 2006 10:38] Valeriy Kravchuk
Verified just as described with 5.0.25-BK on Linux:

openxs@suse:~/dbs/5.0> sh bin/mysql_install_db --defaults-file=/tmp/~/my.cnf
Could not open required defaults file: /tmp/~/my.cnf
Fatal error in defaults handling. Program aborted
Installing all prepared tables
Could not open required defaults file: /tmp/~/my.cnf
Fatal error in defaults handling. Program aborted
Installation of system tables failed!

Examine the logs in /home/openxs/dbs/5.0/var for more information.
You can also try to start the mysqld daemon with:
/home/openxs/dbs/5.0/libexec/mysqld --skip-grant &
You can use the command line tool
/home/openxs/dbs/5.0/bin/mysql to connect to the mysql
database and look at the grant tables:

shell> /home/openxs/dbs/5.0/bin/mysql -u root mysql
mysql> show tables

Try 'mysqld --help' if you have problems with paths. Using --log
gives you a log in /home/openxs/dbs/5.0/var that may be helpful.

The latest information about MySQL is available on the web at
http://www.mysql.com
Please consult the MySQL manual section: 'Problems running mysql_install_db',
and the manual section that describes problems on your OS.
Another information source is the MySQL email archive.
Please check all of the above before mailing us!
And if you do mail us, you MUST use the /home/openxs/dbs/5.0/bin/mysqlbug script
!
openxs@suse:~/dbs/5.0> ls -l /tmp/~
total 4
-rw-r--r--  1 openxs users 617 2006-08-29 19:50 my.cnf
[13 Sep 2006 14:59] Mads Martin Joergensen
Is this not due to shell expansion? What if the ~ is escaped?
[5 Oct 2006 16:42] Paul DuBois
I've modified this section to discourage the use
of "~" in filenames as option values.

http://dev.mysql.com/doc/refman/5.0/en/option-files.html