in reply to Re: connect_with_option_file
in thread connect_with_option_file

Thx for replying graff. I implemented your suggestion as follows:
sub connect_with_option_file { $dsn .= ";mysql_read_default_file=home/gmacfadd/public_html/cg +i-bin/dubois/.my.cnf"; return (DBI->connect ($dsn, undef, undef, {PrintError => 0, RaiseError =>1})); }
I also moved the option file (.my.cnf) to the following directory on my hosting server: home/gmacfadd/public_html/cgi-bin/dubois When I executed, here is the error I received:

Software error: DBI connect('database=gmacfadd_webdb;host=localhost;mysql_read_default_file=home/gmacfadd/public_html/cgi-bin/dubois/.my.cnf','',...) failed: Access denied for user: 'gmacfadd@localhost' (Using password: NO) at /home/gmacfadd/public_html/cgi-bin/dubois/WebDB.pm line 20

The fact the server thinks I'm gmacfadd@localhost instead of gmacfadd_webdev2 is puzzling...possibly meaning that it can't find my option file - but it is there!

Replies are listed 'Best First'.
Re^3: connect_with_option_file
by graff (Chancellor) on Jul 27, 2005 at 14:53 UTC
    Try putting an initial slash in that path string, to make it absolute:
    $dsn .= ";mysql_read_default_file=/home/gmacfadd/public_html/cgi-bin/d +ubois/.my.cnf";
    (update: and if that doesn't work, be sure to check permissions along every step of that path; it needs to be readable by both the web server and the mysql daemon (which typically runs with username "mysql"), so rwxr-xr-x on each directory in the path, and rw-r--r-- on the config file itself.)
      Thanks graff. The initial slash did the trick, I'll show my appreciation now by going to the offering plate.