Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Sam Shield
Sam Shield
6,167 Points

When importing a wp database from my 'hosted' site to my 'local' xampp, phpMyAdmin errors out: "MySQL returned 0 rows"

I created a backup of my hosted site using the BackWpUp plugin. After copying the backup (files and database) to my computer, I can't get the database to import with phpMyAdmin.

Importing phpMyAdmin's "Import" tab and got a 1046 error. So I tried importing using the following query: USE nameofmydatabase;

Then, phpMyAdmin responded with, "MySQL returned an empty result set (i.e. zero rows)."

Any ideas on why a database from my hosted WordPress site will not import into a local xampp environment?

What kind of DB export does BackWpUp provide? Is it just a .sql file?

Sam Shield
Sam Shield
6,167 Points

mikes02,

Yes. BackWpUp exports the DB as a .sql file.

A.J. Kandy
A.J. Kandy
Courses Plus Student 12,422 Points

1046 is a 'no database selected' error. You need to create a new DB first, then import the backup .sql to that db. Then, be sure that the name of the db is reflected in WordPress' config.php file.

Yes, I believe AJ is on the right track here, in XAMPP have you gone into phpMyAdmin and created a database to import into or are you just trying to import the SQL file from the import tab of the main phpMyAdmin page?

Sam Shield
Sam Shield
6,167 Points

I opened the wp_config.php file on my hosted website to find the name of its database.

After that, I installed a WordPress site locally. And during the installation setup, the database was given the same name as the hosted site's database.

Then from the backup files generated from BackWpUp, I imported the hosted site's database (.sql file) into my local site. This is where it errors. For some reason the database will not import successfully.

Just to troubleshoot this issue, tried imported the database after manually exporting it from my host's cPanel. I got the exact same error.

A.J. Kandy
A.J. Kandy
Courses Plus Student 12,422 Points

Sam, did you actually create the new DB in MySQL in your XAMPP setup before importing the files? I'm not sure if it will automatically create a new DB simply by hitting the Import button.

Every time I've done an export-import (when moving hosts, for instance) I had to create the DB and the 'wordpress' user by hand in my SQL admin app beforehand; this is also the second step in the standard WordPress install instructions.

So if it's giving you the error that the DB doesn't exist...maybe you need to create the new DB first?

https://codex.wordpress.org/Installing_WordPress#Detailed_Instructions

Sam Shield
Sam Shield
6,167 Points

mikes02: "When you go into phpMyAdmin from XAMPP are you actually clicking into that database in the left column and then using import?"

You, mikes02, are a supergenius! Figures it was something like that. I needed to select the database first in the left column before importing. Thank you!!!

You're welcome. Glad it helped!

1 Answer

Sam,

When you go into phpMyAdmin from XAMPP are you actually clicking into that database in the left column and then using import?