Import MySql WorPress data base creates error

I usually build Wordpress sites on a server with a different domain than the final destination.
I then export the db in phpMyAdmin, replace the site url, and import into the phpMyAdmin of the final server and domain.
Usually no problem, done it xx times.

Now suddenly I am running into errors either of
"Access denied for user 'xxxxxx'@'localhost'
(that is on the destination server)
or
on the original server where I want to duplicate the db
#1007 - Can't create database 'xxxxx_yyyyy'; database exists

Regarding the original server with the #1007 error:
I see in the sql dump in line 19 and below:

--
-- Database: `xxxxx_yyyyy`
--
CREATE DATABASE `xxxxx_yyyyy` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE `xxxxx_yyyyy`;

I tried replacing that with the name of the empty database in which I want to import, but get the same error.

Hope this makes sense to someone out there.

Please consider in your suggestions that I do not use command-line tools.

Thanks!
SumukhaAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
SumukhaConnect With a Mentor Author Commented:
Thanks for posting, guys (and hi there Jason),

Now imagine this:
I am now doing the EXACT same steps from another computer and it works.

@ Jason "and remove the line from the SQL dump"

I posted four lines. Which one you are referring to?

Thanx
0
 
Tom BeckCommented:
The way I've done it successfully in the past avoids creating the database through phpMyAdmin.  Instead, I let Wordpress create the database and tables and just import the data. That way the permissions are no longer an issue.

- From the Export tab for the database in question in phpMyAdmin, choose Custom - display all possible options.
- Select the table you want or select all.
- View as text.
- Format: SQL
- I usually uncheck "Display comments...". It clutters up the file unnecessarily.
- Under "Dump Table" choose "data". You only want the data, not the structure.
- Under Data Dump Options leave the defaults.
- Click Go

Copy the resulting SQL statements to your clipboard and paste them into a SQL query window of phpMyAdmin on the destination server and execute.
0
 
SumukhaAuthor Commented:
Thanks for posting tommyboy,

How would you duplicate a database then?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Jason C. LevineNo oneCommented:
It sounds like the destination server does not allow CREATE DATABASE to be executed by your user account.  I see this at shared hosting ISPs a lot, security measure of sorts.

Simply create the database according to the instructions provided by the ISP (usually "do it via CPanel") and remove the line from the SQL dump.  If this is a server fully under your control, you will need to check the permissions for that user account.
0
 
Tom BeckCommented:
Probably the way you have attempted, by checking the proper boxes in phpMyAdmin to create the database and tables along with the data. But we are talking about Wordpress here. It's been in development for a long time and no doubt has it's own unique requirements for privileges. Any difference in WP versions between the testing server and the live on could spell trouble. Why risk it? Besides, you always want to have a contingency plan for rebuilding a Wordpress site from scratch. Including rebuilding the databases. Wordpress sites can get corrupted by plugins. Back to your situation, even if the table names were different on my destination server, I would only transfer the data and let Wordpress create the database and tables. In that scenario I would instead save the SQL statements generated by the export to a file, open it in a text editor, find and replace the table names, then execute the statements on the destination server's empty tables. I would not attempt to create the entire structure that way. I'm a web developer, not a database expert, so that's my inclination. Maybe a database expert will post with a different idea.
0
 
Jason C. LevineNo oneCommented:
no doubt has it's own unique requirements for privileges

Nope.  If anything, it's the opposite since WP has to be able to run on nearly any deployment.  WordPress has nothing to do with setting database permissions and issues with plugins result in the site getting hacked and defaced, not database corruption.
0
 
Tom BeckCommented:
Okay Jason, I'll buy that. Do you see anything wrong with my approach though? Have I been doing it wrong all this time? It always works.
0
 
Jason C. LevineNo oneCommented:
CREATE DATABASE `xxxxx_yyyyy` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE `xxxxx_yyyyy`;

Open in new window


This is all one command (two technically) that doesn't need to be there if the database is already created and selected in phpMyAdmin.
0
 
Jason C. LevineNo oneCommented:
Now imagine this:
I am now doing the EXACT same steps from another computer and it works.

Wonderful.  Don't argue with your good fortune?
0
 
SumukhaAuthor Commented:
I always want to know WHY things happen.
0
 
Jason C. LevineNo oneCommented:
I have no idea why the same thing works differently on different boxes :/

The only thing I can think of is that you did change something between attempts...that's the only thing that makes sense.
0
 
SumukhaAuthor Commented:
Nothing. Njente.

Errors for duplicating the oiginal db (export/ import into empty one), as well as import on the other server into an empty one.
0
 
SumukhaAuthor Commented:
Now who gets points?
0
 
Jason C. LevineNo oneCommented:
0
 
SumukhaAuthor Commented:
Thanks, Jason. Will do.

Here is something else for you to peek at:
http://www.experts-exchange.com/Web_Development/Miscellaneous/Q_28325248.html
0
 
SumukhaAuthor Commented:
It works on a different machine and nobody knows why...
0
All Courses

From novice to tech pro — start learning today.