Page 1 of 2

Testing Server database

Posted: Mon Sep 27, 2004 6:53 pm
by bradles
I am using dreamweaver with a testing site and also to deploy my site once I am happy with any updates.

I have php & mysql installed on my localhost server and I was wondering if it is possible to be able to add a database that I can test on my localhost server and then upload to my www server without having to change any code.

I guess this will require the php script to determine if it is on the localhost or on the www host and I would have to have the same directory path on my local machine mimicking the path to the database on the www host.

Sorry if this isn't making any sense. My goal is to be able to set up an exact working duplicate of my site (database and all) on my local machine so I can test it and then deploy it to the www.

Do I need to contact my host provider to find out where they store my databases?

Brad.

Posted: Mon Sep 27, 2004 6:58 pm
by feyd
most mysql databases are hosted on localhost even for web servers.

Posted: Mon Sep 27, 2004 7:01 pm
by patrikG
the only thing you'd need to worry about (if the mysql database is on localhost) is login, password and database name which might be different on your hosting server.

Posted: Mon Sep 27, 2004 7:03 pm
by feyd
I tend to match all those up, cause I'm lazy :P

Posted: Mon Sep 27, 2004 7:08 pm
by bradles
So do I need to add a MySQL database setting it up through my cpanel and then mimick everything on my testing server? Or can I set up the database and everything on my local machine and then just upload it?

Brad.

Posted: Mon Sep 27, 2004 7:08 pm
by patrikG
yup same here. I tend not to set a password and leave the login at the default "root" - a special bit of laziness on my part which broke an online application for a day because I didn't test it afterwards. Makes the old adage: "If it's not tested, it's broken" even more true...

Posted: Mon Sep 27, 2004 7:10 pm
by patrikG
bradles wrote:So do I need to add a MySQL database setting it up through my cpanel and then mimick everything on my testing server? Or can I set up the database and everything on my local machine and then just upload it?

Brad.
First set up the db on the remote server, then mimick everything on your localhost.

Posted: Mon Sep 27, 2004 7:30 pm
by bradles
patrikG wrote:First set up the db on the remote server, then mimick everything on your localhost.
Does that mean I can edit the database on my local machine? Or do I have to test my site, upload php, go into cpanel and edit database manually. That would seem like double handling.

Brad

[EDIT] I just got an email back from tech support saying:
Well although the path to the databases is /x/y/z/databasename you do not have explict access to the above path. Using the phpmyadmin from your mysql feature, you can manage the mysql database and upload your database.
Not sure what I do now.

Posted: Mon Sep 27, 2004 7:46 pm
by Breckenridge
Yes you can edit databases on your own machine and this is how you do it:

1. on your server set an sql user called remotedbuser or anyname you want with your network ip as the host UNDER THE users TABLE.

2. allow the user your created permissions to your database in the db table.

3. when you connect to your server use the ip of your server vs your server name

code and change/update your databases as you please from code running on your local computer.

need more help private message me

Posted: Mon Sep 27, 2004 8:19 pm
by feyd
that'd work if the server db user has remote access rights.. not many installs allow that, esp with cpanel installations.

Posted: Mon Sep 27, 2004 8:29 pm
by bradles
How do you go about it feyd?

In particular, after tech support sent me the following information:
Well although the path to the databases is /x/y/z/databasename you do not have explict access to the above path. Using the phpmyadmin from your mysql feature, you can manage the mysql database and upload your database.
I'm stuck on how to set this up. They have told me the folder path is /x/y/z/databasename but those folders are not in my www path.

Brad

Posted: Mon Sep 27, 2004 8:54 pm
by John Cartwright
correct.. check your servers root path...

Posted: Mon Sep 27, 2004 10:19 pm
by bradles
Phenom wrote:correct.. check your servers root path...
So I just have to add "/x/y/z/databasename" to the root path in order to access the database?

Brad

Posted: Mon Sep 27, 2004 11:00 pm
by feyd
when I want to bring over the stuff.. I make it on the server, export the data, and import it into my local server.

Posted: Tue Sep 28, 2004 12:22 am
by bradles
feyd wrote:when I want to bring over the stuff.. I make it on the server, export the data, and import it into my local server.
Feyd, can you then add tables etc to the database on your local server and update the changes to the db on the www? Or do you have to manually go into the www db and add the new tables and any edits etc?

Brad