Computer Science, asked by ENRIQUEpriyansh8534, 1 year ago

Error 1046 No database Selected, how to resolve?

Answers

Answered by Sreearjunan
0

Answer:You need to tell MySQL which database to use:

USE database_name;

before you create a table.

In case the database does not exist, you need to create it as:

CREATE DATABASE database_name;

followed by:

USE database_name;

Answered by farhanimtiyaz327
0

Solution #1: Before importing

In phpMyAdmin, click on the Export tab from the home page of phpMyAdmin, without selecting any database. phpMyAdmin will then include instructions to create and select the database when you import it.

This solution does not apply to most shared hosts, since they won’t allow you to create a database from phpMyAdmin.

Solution #2: The alternative fix

Unlike solution #1, this one also works on shared hosts.

Create the new database on your server, then write down the name.

Open your .sql file with a text editor

Insert the following line right before the first CREATE TABLE instruction in your .sql file: USE your_database_name_here;

Save your file, then import it in phpMyAdmin.

Similar questions