Zen Cart Logo
Forums / Installing on a Linux/Unix Server / Can't restore database after moving from localhost

Can't restore database after moving from localhost

Views: 2,667

Results 1 to 4 of 4
14 Sep 2013, 12:18 AM
#1
annie_zaz avatar

annie_zaz

Zen Follower

Join Date:
Mar 2013
Location:
Sydney, Australia
Posts:
140
Plugin Contributions:
0

Can't restore database after moving from localhost

Hello,
I looked for my solution to no avail.

I made a customized site on my localhost, then did a backup of my db using phpmyadmin.
I then uploaded my customized files to the server and did the install.
However it looks like the generic version of my zencart see here: https://www.kinectwebdesign.com/zencart
I tried to import the db backup I made from local machine but I get an
Error
SQL query:
CREATE DATABASE example;
MySQL said: Documentation
#1044 - Access denied for user 'example'@'localhost' to database 'example'

I have figured out from reading this post that my server db has a prefix and my localhost db doesn't. http://www.inmotionhosting.com/support/website/database-troubleshooting/mysql-1044-access-denied-error-message
that I have to edit the zencart.sql file.
Here's my problem, the db backup I made on localhost via phpmyadmin, exported it and it looks compressed.
It looks like gobbledegook. Too confusing to edit, so how will I be able to restore the database?
Can can I get a normal looking db back up from localhost phpmyadmin.

This has stumped me for 2 days.:frusty:
Any help greatly appreciated.

14 Sep 2013, 7:23 AM
#2
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Can't restore database after moving from localhost

Annie_zaz:

Can can I get a normal looking db back up from localhost phpmyadmin.

As you have observed, the file you exported was compressed. There is a setting in the phpmyadmin window that will let you export the data in uncompressed format.

Alternatively, you can use your favourite zip/bzip/gzip program to decompress the file so that you can make the needed edits.
(you don't need to re-zip in order to import).

Another option (better for the long term) is to rename the tables of your local installation so they match what you need for the server. This way importing/exporting from one to the other is a breeze. Just make sure you change your local configuration files to match the database changes.

Cheers
Rod

16 Sep 2013, 4:27 AM
#3
annie_zaz avatar

annie_zaz

Zen Follower

Join Date:
Mar 2013
Location:
Sydney, Australia
Posts:
140
Plugin Contributions:
0

Re: Can't restore database after moving from localhost

Ok Rod will give it a go now, I'll let you know how I go !
Thanks for the advice.:smile:

16 Sep 2013, 10:48 AM
#4
annie_zaz avatar

annie_zaz

Zen Follower

Join Date:
Mar 2013
Location:
Sydney, Australia
Posts:
140
Plugin Contributions:
0

Re: Can't restore database after moving from localhost

Annie_zaz:

Ok Rod will give it a go now, I'll let you know how I go !
Thanks for the advice.:smile:
FIXED :smile:
Ok, for anyone with this same problem I had made a database backup on my local machine using phpmyadmin.
It was compressed but I uploaded it to the 'live server' and edited it there via my hosts code editor and it looked normal.
(I did try this the previous night and it didn't work for some reason :huh: and had wasted time trying to edit via notepad and it looked compressed there too:huh:)
I just made the database name the same as the new database that I created before transferring the files over and it worked.