django.db.utils.OperationalError: (1071, 'Specified key was too long; max key length is 767 bytes')

前端 未结 7 634
故里飘歌
故里飘歌 2020-12-15 09:03

My model:

class Course(models.Model):
    language = models.ForeignKey(Language)
    name = models.CharField(max_length=50, unique=True, default=\'course\')
         


        
7条回答
  •  囚心锁ツ
    2020-12-15 09:36

    You can recreate "database" again:

    CREATE DATABASE mydatabase CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
    

    or change config file. Open /etc/mysql/mariadb.conf.d/50-server.cnf and change:

    character-set-server  = utf8
    collation-server      = utf8_general_ci
    

提交回复
热议问题