1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【MySQL】ERROR 1046 (3D000): No database selected 解消法

Posted at

状況

DockerのMySQLのコンテナ内にて以下のように実行したところ表題のエラーが発生しました。

$ mysql> show tables;
ERROR 1046 (3D000): No database selected

解消法

以下のコマンドで使用するデータベースを選択したところ解消しました。

$ mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| sample             |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)

$ mysql> use sample
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
$ mysql> show tables;
+-------------------------+
| Tables_in_sample        |
+-------------------------+
| ar_internal_metadata    |
| samples                 |
| schema_migrations       |
+-------------------------+
3 rows in set (0.01 sec)
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?