Laravel 3 Schema Table Column Collation

前端 未结 5 2098
耶瑟儿~
耶瑟儿~ 2021-02-06 19:44

I\'m learning laravel, and I\'m stuck on a simple process. I want the tables to be generated as UTF-8 but varchar and text fields are like latin-1.

Schema section in gui

5条回答
  •  灰色年华
    2021-02-06 20:23

    Just solved it, (using mysql 5.5 (5.5.29)) with Linux Mint 13 Mate (based on Ubuntu 12.04 LTS)

    I added these lines on /etc/mysqld/my.cnf

    [client]
    default-character-set = utf8
    
    [mysqld]
    init_connect='SET collation_connection = utf8_unicode_ci'
    character-set-server = utf8
    collation-server = utf8_unicode_ci
    

    This way, SQL queries worked on shell as it should, but on laravel or phpmyadmin etc, they didn't work. So I did this:

    I opened /etc/apache2/conf.d/charset and removed the ; from this line:

    AddDefaultCharset UTF-8
    

    Then I restarted apache2 and mysql, now it works as it should.

    Later Edit: That GitHub Core Hack works like a treat. I ended up doing it.

提交回复
热议问题