Accessing MySQL remotely

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • senthilt
    New Member
    • Mar 2010
    • 4

    #1

    Accessing MySQL remotely

    Please let me know, If any one knows how to access MySQL remotely.

    Thanks
    Senthil
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hey.

    The method you use to remotely connect to MySQL depends on what MySQL client you are using.

    For example, in PHP code, you simply specify the remote host in the connection string/function:
    [code=php]<?php
    // Old-school
    $dbLink = mysql_connect(" mysql.example.c om", "YourName", "pwd");

    // PDO
    $dbLink = new PDO("mysql:dbna me=testdb;host= mysql.example.c om", "YourName", "pwd");?>[/code]

    In the MySQL command-line interface, you specify the "--host-name" (or "-h" for short).
    [code=text]$ mysql -h mysql.example.c om -u YourName -p[/code]

    This all depends, of course, on your MySQL server being receptive to remote connections, and that the user you are connecting with has remote access.

    Comment

    Working...