in reply to Re: DBI connection to a remote host
in thread DBI connection to a remote host

Hi Gnork,

Thanks for replying so promptly. To answer your question, I did have the DBD::mysql module installed already. While DBD::OBDC was already installed on my system (I think it probably comes included in the standard activestate Perl release). I tried your suggestion, but instead I get this error message:

DBI connect('database=testdb; host=server; port=3306','tester',...) fa +il ed: Access denied for user: 'tester@localhost' (Using password: YES) a +t dbitest. pl line 15
Again, any further pointers or advice would be appreciated.
Thanks in advance,
Jonathan

Replies are listed 'Best First'.
Re: Re: Re: DBI connection to a remote host
by gellyfish (Monsignor) on Apr 29, 2004 at 11:07 UTC

    This is because the access rights to the database do not allow this connection - you will have to alter this at the MySQL server: you can find out more here

    /J\

      gellyfish is right - and good link to a good explanation on the mysql website. MySQL can be a btch to get working in the beginning - the authentication takes a while to get right.

      *Before* trying to connect to a remote server with DBI/DBD::mysql, get the connection working first just with the mysql client. It's been too long since I've worked with MySQL, but here is the general jist:

      # mysql -u <your-user> -p <remote-database-name> "-p" says to ask you for the password, so you'll get a prompt to enter the password for user <your-user>.
      If it succeeds, you'll get some "connected" message, and a 'mysql>' prompt. Then you can enter mysql commands at that prompt, like these:
      mysql> select * from <table in remote-database-name>;
      Once you can connect from the client machine to the server machine using the 'mysql' client, *THEN* move on to trying to connect using Perl/DBI/DBD::mysql.

      HTH.