z28 has asked for the wisdom of the Perl Monks concerning the following question:

Monks, I seek a quick fix!


I am familiar with, and have put to good use, the DBI connection command:

my $dbh = DBI->connect('DBI:mysql:db_name', 'user', 'pass') or die "Co +uldn't open database: $DBI::errstr";


Here come's the tricky-ness. I have registered a new domain name and hosted it with the same company. I want my script to be run on this new domain and put the results in the same database as the old domain.

Seems a logical request as I can provide my webhost the db_name, db_user, and db_pass for my desired database. Yet, no beans. Password denied, access denied.

Is there a way I can trick the mySQL database into thinking this info is all coming from a "legit" source. Is there some parameter I can add that says "connect to this and say you're from domain1" instead of from my new domain?

My thanks for your efforts in advance, as always.


z28

Replies are listed 'Best First'.
Re: Remote Connection to a mySQL Database
by BeernuT (Pilgrim) on Mar 22, 2002 at 22:59 UTC
    Do you not want to correct the problem the correct way? Mysql has a hosts table to give access to users from different hosts. Perhaps you should take a look at the documentation for mysql located at www.mysql.com

    If there was a way to connect to it by giving it phony information would you really want to be using that database?

    -bn
Re: Remote Connection to a mySQL Database
by gellyfish (Monsignor) on Mar 23, 2002 at 09:33 UTC

    MySQL does permissions on a user/host basis - you will want to read about the access permissions on the MySQL web site

    /J\