Help us understand the problem. What is going on with this article?

laradock環境でmysqlが文字化けしたら

More than 1 year has passed since last update.

参考にしたリンク

https://yudai-stadium.com/blog/laravel-mojibake/

やったこと

config/database.phpの修正

'mysql' => [
             'driver' => 'mysql',
             'host' => env('DB_HOST', '127.0.0.1'),
             'port' => env('DB_PORT', '3306'),
             'database' => env('DB_DATABASE', 'forge'),
             'username' => env('DB_USERNAME', 'forge'),
             'password' => env('DB_PASSWORD', ''),
             'unix_socket' => env('DB_SOCKET', ''),
              //ここの下二つを下記のように変更
             'charset' => 'utf8',
             'collation' => 'utf8_general_ci',
             'prefix' => '',
             'strict' => true,
             'engine' => null,
         ],

laradock/mysql/my.cnfの修正

 # The MySQL  Client configuration file.
 #
 # For explanations see
 # http://dev.mysql.com/doc/mysql/en/server-system-variables.html

 [mysql]

 [mysqld]
 sql-mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
 character-set-server=utf8

-------ここから下を追記-------
 [client]
 default-character-set=utf8 #clientセクションを追加
graffer
「テクノロジーの力で民主主義を拡張する」というヴィジョンのもと、インターネットとテクノロジーを活用し、様々な行政手続きを効率的に行える各種サービスを開発・提供しているスタートアップ企業です。
https://graffer.jp/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした