MySQL con test

Discussion in 'PHP' started by sam20e, Aug 27, 2013.

  1. #1
    Hi guyz

    I found this code :

    http://pastebin.com/gK4qTxVy

    This is to check the mysql connection, the problem is this checks the DB connection internally only. I mean you need to upload this file to the server and check the connection, what i want is where i can externally check the connection.. Meaning if i host this php in my server, i should be able to check any db connection by providing the server name or server ip. Currently if I do this it says access denied in my local server. anyone can guide?

    Thanks
     
    sam20e, Aug 27, 2013 IP
  2. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #2
    You are looking at the "Allow remote access" configuration. Most host will allow you to turn it on to give access to the DB from outside the server.

    For an answer we need to know the host/control panel.
     
    ThePHPMaster, Aug 27, 2013 IP
  3. sarahk

    sarahk iTamer Staff

    Messages:
    28,897
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #3
    They may want to know the IP you are using first.
    Are you testing your own database connections or other people's sites?
     
    sarahk, Aug 27, 2013 IP
  4. creativeGenius

    creativeGenius Well-Known Member

    Messages:
    273
    Likes Received:
    5
    Best Answers:
    1
    Trophy Points:
    120
    #4
    you need to allow remote database connections (most servers doesnt allow them by default)
    you can go to the servers cpanel and add your ip to the list of allowed remote connections

    also, instead of localhost, you need to put the remote database connection (it could be an ip or nameserver eg: mysql.myhost.com)
     
    Last edited by a moderator: Aug 28, 2013
    creativeGenius, Aug 27, 2013 IP
    sarahk likes this.