LoginSignup
0
1

More than 3 years have passed since last update.

MySQLで日本語が???と表示されてしまう時の対処法

Last updated at Posted at 2021-04-08

こう表示されていました

mysql> select * from tags;

+----+-----------+----------------------------+----------------------------+
| id | name      | created_at                 | updated_at                 |
+----+-----------+----------------------------+----------------------------+
|  1 | ???       | 2021-04-07 23:52:14.766919 | 2021-04-07 23:52:14.766919 |
|  2 | ??        | 2021-04-07 23:52:14.811726 | 2021-04-07 23:52:14.811726 |
|  3 | ??        | 2021-04-07 23:52:14.831898 | 2021-04-07 23:52:14.831898 |
|  4 | ???       | 2021-04-07 23:52:14.848186 | 2021-04-07 23:52:14.848186 |
|  5 | ??        | 2021-04-07 23:52:15.171303 | 2021-04-07 23:52:15.171303 |
|  6 | ????????? | 2021-04-07 23:52:15.537739 | 2021-04-07 23:52:15.537739 |
|  7 | ??        | 2021-04-07 23:52:15.653962 | 2021-04-07 23:52:15.653962 |
|  8 | ??        | 2021-04-07 23:52:15.787906 | 2021-04-07 23:52:15.787906 |
|  9 | ??        | 2021-04-07 23:52:15.900384 | 2021-04-07 23:52:15.900384 |
| 10 | ??        | 2021-04-07 23:52:15.917328 | 2021-04-07 23:52:15.917328 |
| 11 | ???       | 2021-04-07 23:52:15.929639 | 2021-04-07 23:52:15.929639 |
| 12 | ????      | 2021-04-07 23:52:15.941627 | 2021-04-07 23:52:15.941627 |
| 13 | ??        | 2021-04-07 23:52:15.954311 | 2021-04-07 23:52:15.954311 |
+----+-----------+----------------------------+----------------------------+

解決方法

このコマンドで、日本語表示を可能にする。

mysql> set names utf8;
mysql> select * from tags;

+----+-----------------------------+----------------------------+----------------------------+
| id | name                        | created_at                 | updated_at                 |
+----+-----------------------------+----------------------------+----------------------------+
|  1 | 食べ物                   | 2021-04-07 23:52:14.766919 | 2021-04-07 23:52:14.766919 |
|  2 | 転職                      | 2021-04-07 23:52:14.811726 | 2021-04-07 23:52:14.811726 |
|  3 | 生活                      | 2021-04-07 23:52:14.831898 | 2021-04-07 23:52:14.831898 |
|  4 | 街並み                   | 2021-04-07 23:52:14.848186 | 2021-04-07 23:52:14.848186 |
|  5 | 仕事                      | 2021-04-07 23:52:15.171303 | 2021-04-07 23:52:15.171303 |
|  6 | ワーキングホリデー | 2021-04-07 23:52:15.537739 | 2021-04-07 23:52:15.537739 |
|  7 | 観光                      | 2021-04-07 23:52:15.653962 | 2021-04-07 23:52:15.653962 |
|  8 | 移住                      | 2021-04-07 23:52:15.787906 | 2021-04-07 23:52:15.787906 |
|  9 | 散歩                      | 2021-04-07 23:52:15.900384 | 2021-04-07 23:52:15.900384 |
| 10 | 留学                      | 2021-04-07 23:52:15.917328 | 2021-04-07 23:52:15.917328 |
| 11 | カフェ                   | 2021-04-07 23:52:15.929639 | 2021-04-07 23:52:15.929639 |
| 12 | ドイツ語                | 2021-04-07 23:52:15.941627 | 2021-04-07 23:52:15.941627 |
| 13 | 天候                      | 2021-04-07 23:52:15.954311 | 2021-04-07 23:52:15.954311 |
+----+-----------------------------+----------------------------+----------------------------+

参考;
https://dev.mysql.com/

0
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
0
1