SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2010
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to connect to mysql remotely

    I have a host running cpanel, and I have phpmyadmin. How do I connect to mysql remotely?
    I would have a few websites tapped into one database... probably in a read only mode.

    Please point me in the right direction.

  2. #2
    SitePoint Evangelist elgumbo's Avatar
    Join Date
    Nov 2002
    Location
    North West, UK
    Posts
    545
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I do this on a few sites.

    In cPanel there is a section called: Manage Remote MySQL Access. You want to add the IP address of the site(s) that will be acessing the database.

    On the site that is accessing the data you want to replace "localhost" in the DB connection string with the actual site address eg: "mysqlsite.com".

    I would also set up a unique user for each site and only give them the permissions they need.

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2010
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks,
    You have saved me countless hours of downloading sql and moving it around site by site.

  4. #4
    SitePoint Enthusiast
    Join Date
    Feb 2010
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh and one more thing.... if you are on a VPS you may need to get your host to open up the firewall that protects your mysql server.

  5. #5
    SitePoint Evangelist elgumbo's Avatar
    Join Date
    Nov 2002
    Location
    North West, UK
    Posts
    545
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No problem. Glad it help.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •