#1046 – No database selected error in phpMyAdmin, fix just in 4 steps

When we are working on a database, then sometimes we get to see an error which is – ” # 1046 – No Database Selected ” .

This error appears when we are going to create a table in the database, or when we are recovering the tables from our backups.


If you see this error, then you can fix this error by following the steps given below :

For phpMyAdmin:- #1046 database not selected

# 1046 - Database Not Selected - create database
Fig: Create database

1. If you want to import tables from database backups and you are working on phpMyAdmin then first you need to create a new database.

#1046 - database not selected - import
Fig: import table

2. After creating the database, you have to select that database. At the top right you will see some tabs. You have to click the Import tab.

#1046 - database not selected - import table
Fig: import and select file

3. And inside the Import tab, you will see a browse button. Click that button.

4. After that a new window will open from which you can select your database backup file and at the end of the page you will see the Go button click on that. Your database error will be removed.

For MySQL Server:- 

  • On the other hand, if you are working on MySQL server then before creating table you have to choose database. For this, you can use following command :

    use  Database_Name;

  • After selecting database, then you can create any table or import table from database backup file.

Leave a Comment