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.
Solution:
If you see this error, then you can fix this error by following the steps given below :
For phpMyAdmin:- #1046 database not selected
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.
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.
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.