Bug #5056 defaults-extra-file throws no error when file is inaccessible
Submitted: 14 Aug 2004 15:33 Modified: 12 May 2005 20:20
Reporter: Christian Hammers (Silver Quality Contributor) (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:4.0.20 OS:Linux (Debian GNU/Linux)
Assigned to: Ramil Kalimullin

[14 Aug 2004 15:33] Christian Hammers
Description:
When trying to use a config file that is not readable by the current user, mysql does not exit nor even print a warning. This can lead to big confusion as such config files are often used to store user and password information.

How to repeat:
$ ls -al /etc/mysql/debian.cnf 
-rw-------  1 root root 146 2004-08-10 20:37 /etc/mysql/debian.cnf

$ sudo cat /etc/mysql/debian.cnf 
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = debian-sys-maint
password = xxx

ch@app109$ mysql --defaults-extra-file=/etc/mysql/debian.cnf
...
mysql> SELECT user();
+--------------+
| user()       |
+--------------+
| ch@localhost |
+--------------+

Suggested fix:
Print at least a warning if the file is inaccessible.
[17 Aug 2004 3:02] Matt Lord
I was able to also verify this using the 4.1.3 client on Linux (2.4.21 #12 SMP) this way:

created /tmp/my.cnf and put the user=root and password=xxxx options in the [mysqld] 
group.

made /tmp/my.cnf only readable by root

mysql --defaults-extra-file=/tmp/my.cnf 

No warnings or errors, just was not able to log in until I made the file world readable.
[25 Feb 2005 13:30] Ramil Kalimullin
Fixed in 4.0.21
[10 Mar 2005 7:35] 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/internals/22876
[7 May 2005 12:03] Ramil Kalimullin
fixed in 5.0.6
[12 May 2005 20:20] Paul Dubois
Noted in 5.0.6 changelog.