CHARACTER SET

mysql> show tables;
+-----------------+
| Tables_in_w0811 |
+-----------------+
| t               |
| w_engine        |
| w_engine_b      |
| w_engine_c      |
| w_int           |
+-----------------+
5 rows in set (0.00 sec)

mysql> create table if not exists student
    -> (
    ->  sno int primary key,
    ->  sname VARCHAR(20) CHARACTER SET gbk,
    ->  sage TINYINT,
    ->  shair ENUM(‘黑‘,‘白‘)
    -> );
ERROR 1291 (HY000): Column ‘shair‘ has duplicated value ‘?‘ in ENUM
mysql> insert into student values(‘1‘,‘李强‘,23,‘黑‘);
ERROR 1146 (42S02): Table ‘w0811.student‘ doesn‘t exist
mysql> insert into student values(‘2‘,‘刘丽‘,22,‘白‘);
ERROR 1146 (42S02): Table ‘w0811.student‘ doesn‘t exist
mysql> insert into student values(‘5‘,‘张友‘,22,‘黑‘);
ERROR 1146 (42S02): Table ‘w0811.student‘ doesn‘t exist
mysql> insert into student values(‘53‘,‘张友‘,22,‘额黑‘);
ERROR 1146 (42S02): Table ‘w0811.student‘ doesn‘t exist
mysql> select * from student;
ERROR 1146 (42S02): Table ‘w0811.student‘ doesn‘t exist
mysql>
mysql> show tables;
+-----------------+
| Tables_in_w0811 |
+-----------------+
| t               |
| w_engine        |
| w_engine_b      |
| w_engine_c      |
| w_int           |
+-----------------+
5 rows in set (0.00 sec)

mysql> create table if not exists student
    -> (
    ->  sno int primary key,
    ->  sname VARCHAR(20) CHARACTER SET gbk,
    ->  sage TINYINT,
    ->  shair ENUM(‘黑‘,‘白‘) CHARACTER SET gbk
    -> );
Query OK, 0 rows affected (0.01 sec)

mysql> insert into student values(‘1‘,‘李强‘,23,‘黑‘);
Query OK, 1 row affected (0.00 sec)

mysql> insert into student values(‘2‘,‘刘丽‘,22,‘白‘);
Query OK, 1 row affected (0.00 sec)

mysql> insert into student values(‘5‘,‘张友‘,22,‘黑‘);
Query OK, 1 row affected (0.00 sec)

mysql> insert into student values(‘53‘,‘张友‘,22,‘额黑‘);
ERROR 1265 (01000): Data truncated for column ‘shair‘ at row 1
mysql> select * from student;
+-----+-------+------+-------+
| sno | sname | sage | shair |
+-----+-------+------+-------+
|   1 | 李强  |   23 | 黑    |
|   2 | 刘丽  |   22 | 白    |
|   5 | 张友  |   22 | 黑    |
+-----+-------+------+-------+
3 rows in set (0.00 sec)

mysql>
mysql> show variables like ‘%set%‘;
+---------------------------------------+---------------------------------------
----------+
| Variable_name                         | Value
          |
+---------------------------------------+---------------------------------------
----------+
| auto_increment_offset                 | 1
          |
| character_set_client                  | gbk
          |
| character_set_connection              | gbk
          |
| character_set_database                | latin1
          |
| character_set_filesystem              | binary
          |
| character_set_results                 | gbk
          |
| character_set_server                  | latin1
          |
| character_set_system                  | utf8
          |
| character_sets_dir                    | D:\wamp64\bin\mysql\mysql5.7.11\sharecharsets\ |
| innodb_monitor_reset                  |
          |
| innodb_monitor_reset_all              |
          |
| optimizer_trace_offset                | -1
          |
| performance_schema_setup_actors_size  | -1
          |
| performance_schema_setup_objects_size | -1
          |
| transaction_write_set_extraction      | OFF
          |
+---------------------------------------+---------------------------------------
时间: 2024-10-10 21:14:19

CHARACTER SET的相关文章

20170427报错UnicodeEncodeError: ‘gbk’ codec can’t encode character ‘\xa0’ in position

今天写python,将网上数据流编写进文件里时遇到的,网上搜到结果并正确的进行了处理,把原文解决方法拷过来了,嘿嘿 使用Python写文件的时候,或者将网络数据流写入到本地文件的时候,大部分情况下会遇到:UnicodeEncodeError: 'gbk' codec can't encode character '\xa0' in position - 这个问题. 网络上有很多类似的文件讲述如何解决这个问题,但是无非就是encode,decode相关的,这是导致该问题出现的真正原因吗?不是的.

java.lang.IllegalArgumentException: Illegal character in query at index 261

在BaseFragment中使用了LoadingPage,而LoadingPage的联网加载使用的是AsyncHttpClient.一直报java.lang.IllegalArgumentException: Illegal character in query at index 261解析不成功,改成OkHttp解析即可. 网上有些方法,说先URLEncode再拼接,如果解决不了,换个联网请求方式,试一下.

IEF could not decode Chinese character in IE history well

My friend is working on some case, and she looks not in the mood. I ask her what's going on. She wants me to look at the screenshot as below. That's why she is upset...IEF could not decode Chinese character in IE history well, so the filenames in Chi

newLISP处理mysql escape character

什么是转义字符 mysql的escape character指的是需要转义的特殊字符,这些字符出现在sql语句中,如果没有转移会导致sql语法报错或者有sql注入攻击的可能. 主要有以下几种都需转义: \x00, \n, \r, \, ', " and \x1a. 比如' 就需要变成\' 下面是sql测试: mysql> INSERT INTO nodes(name) VALUES ('select a.dt, count(*), count(distinct a.uv) from (se

mysql报错问题解决Character set 'utf8mb4' is not a compiled character set

mysql: Character set 'utf8mb4' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file 报错的解决方法 1.由于日常程序使用了字符集utf8mb4,为了避免每次更新时,set names utf8mb4,就把配置文件改了,如下: 增加了mysql客户端的默认字符集设置 [[email protected]~]# vim

UnicodeEncodeError: 'ascii' codec can't encode character u'\u5728' in position 1

s = "图片picture"print chardet.detect(s) for c in s.decode('utf-8'): print c UnicodeEncodeError: 'ascii' codec can't encode character u'\u5728' in position 1 解决方案: reload(sys) sys.setdefaultencoding("utf8") UnicodeEncodeError: 'ascii' co

【Python】SyntaxError: Non-ASCII character '\xe8' in file

遇到的第一个问题: SyntaxError: Non-ASCII character '\xe8' in file D:/PyCharmProject/TempConvert.py on line 2, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details 原因:注释里面出现了中文,而 Python 支持的 ASCII 码无中文. 解决方法:在头文件中添加如下代码: # -*- coding:

Leetcode-387 First Unique Character in a String

#387.   First Unique Character in a String Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1. Examples: s = "leetcode" return 0. s = "loveleetcode", return 2. Note: You m

SyntaxError: Non-ASCII character '\xe7' in file

错误提示: SyntaxError: Non-ASCII character '\xe7' in file 出现这种错误的原因是程序中的编码出问题了,只要在程序的最前面加上 出现这种错误的原因是程序中的编码出现了问题,只要在程序的最前面添加,一定要是最前面哦 #_*_coding: UTF-8 _*_ SyntaxError: Non-ASCII character '\xe7' in file

leetcode修炼之路——387. First Unique Character in a String

最近公司搬家了,有两天没写了,今天闲下来了,继续开始算法之路. leetcode的题目如下: Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1. Examples: s = "leetcode" return 0. s = "loveleetcode", return 2. Note: Y