LoginSignup
0
0

More than 5 years have passed since last update.

LaravelでDBのデフォルト文字セットと照会順序を変更する

Last updated at Posted at 2019-04-17

使用するMySQLのデフォルト文字セットと照会順序と、Laravelの設定を合わせたい時に。

使いたいMySQLの設定

_ 2019-04-17 23.36.54.jpg

Laravelの設定を変えるため、database.phpを編集する

config/database.php
'mysql' => [
            
            // 'charset' => 'utf8mb4',
            // 'collation' => 'utf8mb4_unicode_ci',
            'charset' => 'utf8',
            'collation' => 'utf8_general_ci',
            
        ],

これでmigrationでテーブルを作り直せば、文字セットと照会順序が統一できる。

参考

https://qiita.com/n-funaki/items/6ce33602d096da0968f4
https://www.playfulit.net/articles/kzvXJM6YfWT1mUP492odNfBR

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