Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

PHP: Connection to a MYSQL host externally.

  • 24-10-2010 2:01pm
    #1
    Closed Accounts Posts: 6,281 ✭✭✭


    Hi all,

    I have recently got another website domain and host and for the moment would like to mirror my old website onto the new one.

    I'm trying to connect to a database on my old server so I can query it in the same way on my new site.

    Is there anyway to find out what my external MYSQL IP/address is?

    Thanks.


Comments

  • Registered Users, Registered Users 2 Posts: 26,584 ✭✭✭✭Creamy Goodness


    who hosted your old server? they should be able to tell you the address, then you can use

    [php]
    link = mysql_connect('example.com:3307', 'mysql_user', 'mysql_password');
    [/php]

    instead of the usual or what you might have been using:

    [php]
    link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
    [/php]


  • Closed Accounts Posts: 6,281 ✭✭✭Ricky91t


    who hosted your old server? they should be able to tell you the address, then you can use

    [php]
    link = mysql_connect('example.com:3307', 'mysql_user', 'mysql_password');
    [/php]

    instead of the usual or what you might have been using:

    [php]
    link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
    [/php]

    Thanks for that, I'm still using both hosts ( it's hostso.com btw!) I spoke to them on their support and using my function I just change localhost to jet.nseasy.com:2082' but it's not connecting, Was wondering if there was any way like making a info.php script to find a direct link to mt databases.


  • Registered Users, Registered Users 2 Posts: 67 ✭✭The Gibmiester


    I know with Blacknight there's a checkbox in the control panel you need to tick to allow an external host to access a database. You need to add the IP of the external host too. Maybe you're hosting has something similar.


  • Registered Users, Registered Users 2 Posts: 9,579 ✭✭✭Webmonkey


    I know with Blacknight there's a checkbox in the control panel you need to tick to allow an external host to access a database. You need to add the IP of the external host too. Maybe you're hosting has something similar.
    +1 on this. Think MySQL by default only allowed localhost to access the server. Depends how the host has it configured.


  • Registered Users Posts: 339 ✭✭spoonface


    who hosted your old server? they should be able to tell you the address, then you can use

    [php]
    link = mysql_connect('example.com:3307', 'mysql_user', 'mysql_password');
    [/php]instead of the usual or what you might have been using:

    [php]
    link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
    [/php]

    One question on these - the above specifies server,user and password. But how does the database name within that server get specified? i.e. how does it know which database you want to connect to?


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 2,011 ✭✭✭lynchie


    spoonface wrote: »
    One question on these - the above specifies server,user and password. But how does the database name within that server get specified? i.e. how does it know which database you want to connect to?

    Make the connection first, then select the db with mysql_select_db


Advertisement