zoukankan      html  css  js  c++  java
  • 报错django.db.utils.InternalError: (1366, "Incorrect string value: '\xxx\xxx\xxx\xxx\xxx\xxx' for column 'name' at row 1")

    当你执行 python manage.py migrate 时,提示 django.db.utils.InternalError: (1366, "Incorrect string value: '\xxx\xxx\xxx\xxx\xxx\xxx' for column 'name' at row 1") 错误,不要慌。

    这个时候先去看看你的models里面有没有中文字符!

    解决方案:
    方案一、更改库的默认字符集

    创建库的时候指定默认字符集:

     create database 库名 default charset=utf8; 
    或者修改现有库的字符集:

     alter database 库名 character set utf8; 
    方案二、更改表的默认字符集,

    创建表的时候指定默认字符集

     create table 表名 (...) default charset=utf8; 
    或者修改现有表的字符集

     alter table 表名 character set utf8; 

  • 相关阅读:
    shell eval命令
    嘟嘟嘟
    07 linkextractor的基本用法
    rabbitmq消息队列
    5. 哨兵集群
    4.主从同步
    3. redis持久化存储
    2. redis 安全
    1.redis基础
    06. scrapy的Request对象
  • 原文地址:https://www.cnblogs.com/dsynb/p/14701084.html
Copyright © 2011-2022 走看看