Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^6: Reading host from defaults file with DBD::mysql

by parv (Vicar)
on Feb 01, 2019 at 18:32 UTC ( #1229254=note: print w/replies, xml ) Need Help??


in reply to Re^5: Reading host from defaults file with DBD::mysql
in thread Reading host from defaults file with DBD::mysql

The file, as part of $dsn string, is passed to DBI->connect method. I failed to find in (top level) DBI & DBD::mysql sources a point where it would have been parsed.

Replies are listed 'Best First'.
Re^7: Reading host from defaults file with DBD::mysql
by pryrt (Monsignor) on Feb 01, 2019 at 20:16 UTC

    Sorry, I didn't notice the filename went into the $dsn -- I'm not a database expert, and didn't know it could go there. Digging into the code, it appears that it's parsed via the underlying c code, using mysql_options(sock, MYSQL_READ_DEFAULT_FILE, df);. The mysql-options documentation says that you use that option to get it to read from the given file... The option-files doc claims that "Leading and trailing spaces are automatically deleted from option names and values", which implies that spaces around the equal shouldn't matter. It may be that you've got a different version of mysql than the 8.0 reference manual my searches brought me to, or that the statement is misleading and spaces around the equal are bad.

    edit: fix "optoins" typo. Also, want to clarify: when I saw the anonymous "seriously" reply, I wanted something slightly more helpful than that. However, I was apparently confused into believing the parsing was something you had done externally to what you had quoted, rather than something that mysql handles internally. So instead of being helpful, I went in the wrong debug direction. Sorry.

      Hmmmmmmmmmmm............

      I DID recently switch from community MySQL to MariaDB 10.2 (because it's apparently my only practical option on Gentoo Linux for a Galera cluster). Could MariaDB maybe be doing something iffy...? It wouldn't be the first behavioral change I've seen in MariaDB with no clearly apparent technical reason than to diverge from MySQL.

      (That said, I do laud MariaDB for not adopting MySQL 5.6's ill-conceived and badly-implemented history-sanitization "feature".)

        FWIW, there is (relatively) new DBD::MariaDB. (I do not know if it provides a configuration parser that would be more flexible to keep the file easier to read by allowing whitespace around "=" sign.)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1229254]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2020-10-22 01:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (225 votes). Check out past polls.

    Notices?