MySQL looks at usernames not as 'username' but as 'username@ip_addresss'. Off the command line this generally ends up as 'username@localhost' which is the default allow when you do a grant. In the mysql database user table the Host field can be amongst other things 'localhost' - allow local conns for that user or '%' which as expected allows connections from an ip that matches '%' ie all. Quickfix:

DBI->connect("DBI:mysql:database=DATABASE_NAME", "USER_HERE@localhost", "USER_HERE_PW", If you actually mean really remote access you need this syntax: $port = 3306; $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port"; $dbh = DBI->connect($dsn, $user, $password); # more details on this (you could update the Host field from 'localhos +t' # to '%' and FLUSH PRIVILEGES to get it to take effect. mysql> use mysql Database changed mysql> show tables; +-----------------+ | Tables_in_mysql | +-----------------+ | columns_priv | | db | | func | | host | | tables_priv | | user | +-----------------+ 6 rows in set (0.00 sec) mysql> select * from user\G *************************** 1. row *************************** Host: localhost User: root Password: bipitybopityboo Select_priv: Y Insert_priv: Y Update_priv: Y Delete_priv: Y [snip] max_questions: 0 max_updates: 0 max_connections: 0 *************************** 2. row *************************** Host: % User: remote_god Password: TheCanBeOnlyOne Select_priv: HeavenOrHell Insert_priv: Adam&Eve Update_priv: Birth Delete_priv: Death [snip] max_questions: Eternal max_updates: Last try failed max_connections: ?

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print


In reply to Re: Remote Database Connection... in MySQL by tachyon
in thread Remote Database Connection... in MySQL by powerhouse

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.