Page 1 of 1
Database Names
Posted: Mon Aug 04, 2008 5:30 pm
by DaveBunny
I have installed opencart locally whilst I have been developing it. However the time has come to upload to my host. The problem is that my host can't rename the database names that they assign which obviously don't match the tables I set up locally.
Any ideas?
Apologies if there is a really simple answer to this.
Thanks
Dave
Re: Database Names
Posted: Mon Aug 04, 2008 7:31 pm
by bruce
Hi Dave,
You can upload all the local files to the location of your choice on the web server and...
either
- run the installer and tell it the new database name and database username/password combination
- enter all your products again and upload all the images etc
or
- edit your config files to "point" the store to the new file system / url combination and also the database name and database username/password combination.
- export your local database using mysql and import it into the new database name on the server using the same file
hope this helps
Bruce
Re: Database Names
Posted: Mon Aug 04, 2008 8:20 pm
by Qphoria
Dave,
I assume you mean that you are using a dbname like "opencart" and your host wants to prefix your sitename like "davesite_opencart"
Can't you just upload everything, import your sql and then rename the dbname in the config.php and admin/config.php? You shouldn't have to do a reinstall.
Re: Database Names
Posted: Mon Aug 04, 2008 9:06 pm
by DaveBunny
Qphoria wrote:
Dave,
I assume you mean that you are using a dbname like "opencart" and your host wants to prefix your sitename like "davesite_opencart"
Can't you just upload everything, import your sql and then rename the dbname in the config.php and admin/config.php? You shouldn't have to do a reinstall.
Thanks to both of you so far...
My host assigns a name relating to my domain e.g. kitchencab_db1. So if I change the db name and password in my config files, it will work on my host. And as well, if I change my db name and password locally to match I will be able to continue editing using localhost?
Thanks again
Dave
Re: Database Names
Posted: Mon Aug 04, 2008 9:10 pm
by Qphoria
Yes.
If you want to have the same files on both local and remote, and not have to change the config files each time, then yea you can change your local db to the same name/user/pass and it will work seamlessly.
Re: Database Names
Posted: Tue Aug 05, 2008 5:02 pm
by DaveBunny
Qphoria wrote:
Yes.
If you want to have the same files on both local and remote, and not have to change the config files each time, then yea you can change your local db to the same name/user/pass and it will work seamlessly.
what about the URL's in the config files? They would have to be changed each time still wouldn't they?
Thanks for you input.
Dave
Re: Database Names
Posted: Tue Aug 05, 2008 6:10 pm
by Qphoria
urls would of course. You can't have your cake and eat it
But at least the database stuff would be the same because localhost would be relative to the server you are on.
Re: Database Names
Posted: Tue Aug 05, 2008 10:11 pm
by hm2k
You could do if statements to workout what the URLs should be, but this depends on your level of understanding of PHP.
Re: Database Names
Posted: Tue Aug 05, 2008 10:15 pm
by Qphoria
hm2k wrote:
You could do if statements to workout what the URLs should be, but this depends on your level of understanding of PHP.
True, but how complex do we want to make this. You could probably even do the logic right in the config.php file (in fact you'd probably have to since they are define constants). But I think just uploading all files except the configs and you should be ok.