i need to get my clients website online and have been able to figure everything out except of course the most crucial part which is the database upload. i can't figure out what i'm doing wrong since every tutorial and forum i've been on has basically told me to do the same things and still i get errors. i'm missing a crucial point that must be assumed. the test i've made was to locally move my database by simply copying my local site and renaming the database and adjusting my config.php file accordingly. after that i figured my database was set for upload but after uploading i get the error: #1046 = No database selected.

how can there be no database selected?

  • Hi! Please use proper upper-/lowercase letters and the formatting possibilities from the editor. The question, as it currently stands, is pretty hard to read. When someone is scanning questions for a problem later, she/he will have a hard time reading this quickly and we want to help later readers too, right? :)
    – kaiser
    Commented Sep 18, 2012 at 8:21

2 Answers 2


99.99% chance that you configure wordpress with wrong database details.

make sure you are using correct database details in wp-config.php file

/** The name of the database for WordPress */
define('DB_NAME', 'database_name_here');

/** MySQL database username */
define('DB_USER', 'username_here');

/** MySQL database password */
define('DB_PASSWORD', 'password_here');

/** MySQL hostname */
define('DB_HOST', 'localhost');

some possibilities are listed here based on my experience:

  1. May be you didn't use any prefix with database name or user name, which are added by default when we create them on online server.

  2. May be using wrong server details. mostly we use localhost but sometimes database server may be use from outside.

  3. May be user not assign to database.

Hope this helps you. All the best ;)

  • I can't even get to the point where I need to alter the wp-config.php file. While the site was located on my local server I was able to copy and adjust the wp-config, thats what makes me think the problem i have is with the database export from phpMyAdmin. Commented Sep 18, 2012 at 9:17
  • i'm not really even sure i have this database prefix thing figured out. i named the database one thing on my local and then on my host site (1&1) i don't have the option to name the database so i select the database with the description i gave it and try importing to that location. Commented Sep 18, 2012 at 9:27
  • thanks techguy those are helpful but i'm transferring a database which is where my problem begins. i can set up a database but when i import the sql document to the database i set up things fall apart. Commented Sep 18, 2012 at 9:55
  • Read this faq.1and1.co.uk/web_space__access/mysql/phpmyadmin/3.html Commented Sep 18, 2012 at 10:14

If you did a db export from phpMyAdmin and are trying to run the big SQL statement, you may need to add a line to that file telling MySQL what database to use, as phpMyAdmin doesn't do this by default.

before any of the inserts, put the line

use my_database;

Make sure to substitute the correct name for my_database, and don't forget the semicolon. Then try to run the statement. Hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.