Sometimes you might get this error ERROR 1046 (3D000) No database selected in MySQL. Now we will see When MySQL throws ERROR 1046 (3D000) No database selected, and how we can resolve it.
Reason of MySQL ERROR 1046 (3D000) No database selected
MySQL can have multiple databases. So, when we don’t know about it and we execute the query directly, MySQL throws ERROR 1046 (3D000) No database selected. It indicates that we did not select any particular database. So we have to select the database before executing any query.
How to resolve ERROR 1046 (3D000) No database selected in MySQL
Now we know that ERROR 1046 (3D000) No database selected thow when we did not select any database. So to resolve Error 1046 in MySQL, we have to select the database before executing any query.
To Select the database in MySQL use statement is used. Below is the syntax of use statement in MySQL.
USE database_name;
If your database name is Employee then you will run
USE Employee;
Statement to select the Employee database;