Error 1046 3d000 no database selected

Error 1046 3d000 no database selected

Я создал свою первую базу данных для лаборатории, и когда я пытаюсь запустить ее в MySQL, я получаю ту же ошибку 1046: база данных не выбрана.

Сначала я запускаю source (scriptfilename) .sql и получаю:

То же самое происходит, когда я пытаюсь показать свои таблицы:

Я не уверен, что что-то не так с базой данных, которую я создал, или я неправильно ввожу команды в MySQL.

Error SQL query:

need some help here.

16 Answers 16

You need to tell MySQL which database to use:

before you create a table.

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

You can also tell MySQL what database to use (if you have it created already):

I faced the same error when I tried to import a database created from before. Here is what I did to fix this issue:

1- Create new database

2- Use it by use command

This works for me.

If you’re trying to do this via the command line.

If you’re trying to run the CREATE TABLE statement from the command line interface, you need to specify the database you’re working in before executing the query:

If you’re trying to do this via MySQL Workbench.

. you need to select the appropriate database/catalog in the drop down menu found above the :Object Browser: tab. You can specify the default schema/database/catalog for the connection — click the "Manage Connections" options under the SQL Development heading of the Workbench splash screen.


This all assumes there’s a database you want to create the table inside of — if not, you need to create the database before anything else:

Читайте также:  Как делать резервные копии на айфоне

If you are doing this through phpMyAdmin:

I’m assuming you already Created a new MySQL Database on Live Site (by live site I mean the company your hosting with (in my case Bluehost)).

Go to phpMyAdmin on live site — log in to the database you just created.

Now IMPORTANT! Before clicking the "import" option on the top bar, select your database on the left side of the page (grey bar, on the top has PHP Myadmin written, below it two options:information_schema and name of database you just logged into.

once you click the database you just created/logged into it will show you that database and then click the import option.

That did the trick for me. Really hope that helps

One man’s trash, another man’s treasure

MySQL ERROR 1046 (3D000): No database selected

While I was trying to view the tables in a given database, I encountered the following error:

then the MySQL client just connects to the database server. After this, you will have to specify the database name, which you intend to use:

If you don’t like the above method, what you can do is directly specify the database at startup only.

Ссылка на основную публикацию
Adblock detector