Bug #44824 | mysql_real_connect() does not read my.cnf correctly | ||
---|---|---|---|
Submitted: | 12 May 2009 14:13 | Modified: | 15 May 2009 7:19 |
Reporter: | A B | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: C API (client library) | Severity: | S3 (Non-critical) |
Version: | 4.1, 5.0, 5,1, 6.0 bzr | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[12 May 2009 14:13]
A B
[13 May 2009 5:17]
Sveta Smirnova
Thank you for the report. > everything worked as expected. So what is the bug here?
[13 May 2009 7:19]
A B
the bug is that mysql_real_connect() should read the conffile (here /etc/my.cnf) and act accordingly. The current version uses obviously some fallback, driving users nuts that expect that /etc/my.cnf will influence programm that use libmysqlclient. if that is not done you have the situation we found that different versions of libmysqlclient fallback to different socket(path)s and only one of two programms is working. strings libmysqlclient.so.15 | grep mysql.sock /var/lib/mysql/mysql.sock strings libmysqlclient.so.16 | grep mysql.sock /var/run/mysql/mysql.sock
[13 May 2009 7:50]
Sveta Smirnova
Thank you for the feedback. Verified as described. Strange, but if specify just mysql_options(mysql,MYSQL_READ_DEFAULT_GROUP,"your_prog_name"); program will read options in [client] section in /etc/my.cnf as well.
[14 May 2009 20:14]
Omer Barnir
The need to call mysql_options() in order to make mysql_real_connect() use the cnf file is the expected behavior. See http://dev.mysql.com/doc/refman/5.1/en/mysql-real-connect.html
[15 May 2009 7:19]
A B
@Omer BarNir: if you mean with cnf file "my-home-brew-cnf-file" i agree. but we are talking about the general my.cnf that is not read with the current mysql_real_connect() and THAT is a surprise. Sveta Smirnova is surprised that if you specify a new cnf.file the code still reads the client section of my.cnf i guess to make sure that there is a propper init and that is a feature document only in the example end of the page.