Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Hosting Requirements /

What you need to consider when choosing a hosting provider and plan.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

is it possible to use MySQL database hosted on another ISP from the silverstripe site?


Go to End
Reply


12 Posts   4439 Views

Avatar
supermegaultra

Community Member, 33 Posts

24 December 2009 at 9:20am

Edited: 24/12/2009 9:42am

Hey all,

Just like the title says, is it possible to connect to a MySQL database which is hosted on a different ISP to the ISP that Silverstripe is hosted on?

Specifically my mate has his site hosted on one of the new Telecom hosting plans, but they use MSSQL. So was thinking I could connect to the MySQL database that's hosted on my isp!?

Cheers.

Avatar
Fuzz10

Community Member, 787 Posts

25 December 2009 at 1:24am

Doubtful , since the ISP that hosts your database probably does not allow direct connections to the MySQL server.

Avatar
pinkp

Community Member, 168 Posts

11 January 2010 at 8:47am

I've done it with loads of sites, you just need to put: mydomain.com
Rather than localhost in the _config.php file.

You may also need to allow the connection, on my cpanel on my MySQL host I just added the IP address and domain name from the control panel of my SS host.

I got stuck with one and the hosting company sorted it for me.
Need help or better instructions let me know!

Avatar
supermegaultra

Community Member, 33 Posts

13 January 2010 at 11:52am

Edited: 13/01/2010 11:53am

Cheers pinkpoliceman! I had a feeling it must be possible.

I've asked the hosting company to allow access for the for the websites IP address and domain and have also updated the details in the _config.php, but when installing silverstripe (mydomain.com/silverstripe/install.php) and after re-checking the requirements I am presented with a blank white page that doesn't do anything.

I'd just like to check that the 'localhost' line I need to change is:

Director::set_dev_servers(array(
   'localhost',
   '127.0.0.1',
));

Looking forward to your reply! Cheers.

Avatar
pinkp

Community Member, 168 Posts

13 January 2010 at 12:07pm

hi supermegaultra,

no not that part here is an example of the _config.php in the mysite folder.

<?php

global $project;
$project = 'mysite';

global $databaseConfig;
$databaseConfig = array(
"type" => "MySQLDatabase",
   "server" => "yourdomain.com",
   "username" => "your_username_for_that_db",
   "password" => "your_password_for_that_user",
   "database" => "your_MySQL_DB",
);

// Sites running on the following servers will be
// run in development mode. See
// http://doc.silverstripe.com/doku.php?id=devmode
// for a description of what dev mode does.
Director::set_dev_servers(array(
   'localhost',
   '127.0.0.1',
));

// This line set's the current theme. More themes can be
// downloaded from http://www.silverstripe.com/themes/
SSViewer::set_theme('tutorial');

//Director::set_environment_type("dev");
Debug::send_errors_to("me@mydomain.co.uk");

?>

When you installed SS, you should have entered the details as above, (if that corresponds I don't the install screen to look at right now), the part you said just leave as is. Im not sure if you need the 'www.' when you enter the server address I haven't so far.
This includes some debug stuff which i find helpful.

Hope that's helpful! let me know if not!

Avatar
supermegaultra

Community Member, 33 Posts

14 January 2010 at 9:11am

Thanks again!

I'm still unable to get Silverstripe to install and connect to the remote MySQL database, but I think it could be something to do with the hosting company not adding the IP address and domain name properly. I will check with them once they're back from holidays.

Just to double check - the database server name I'm connecting to is 'mysql.designalt.co.nz' and the database name is 'jacksmachinery'. I have connected to this before perfectly using a silverstripe installation that is hosted on the same domain (designalt.co.nz). Perhaps I should make another MySQL database alongside the 'jacksmachinery' one?

Thoughts? Cheers!

Avatar
pinkp

Community Member, 168 Posts

14 January 2010 at 9:23am

Yeah there's no harm in setting up another db.
When you try and install what message do you get? This could determine whether or not it is even finding the server or the db etc..?

Avatar
supermegaultra

Community Member, 33 Posts

14 January 2010 at 9:32am

Ahh no it's not finding the database at all. I've tried 'mysql.designalt.co.nz' along with plain old 'designalt.co.nz' too.

Error message I recieve is "Can't find the a MySQL server on 'mysql.designalt.co.nz': Unknown MySQL server host 'mysql.designalt.co.nz' (11004)"

Perhaps I'll wait until I have heard back from the hosting company that looks after the MySQL server and double check that they have the right IP and DNS.

Cheers!

Go to Top