CREATE TABLE IF NOT EXISTS tdb_Goods( goods_id SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, goods_name VARCHAR(150)
CREATE TABLE IF NOT EXISTS tdb_Goods(
goods_id SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
goods_name VARCHAR(150) NOT NULL,
goods_cate VARCHAR(40) NOT NULL,
brand_name VARCHAR(40) NOT NULL,
goods_price DECIMAL(15,3) UNSIGNED NOT NULL DEFAULT 0,
is_show BOOLEAN NOT NULL DEFAULT 1,
is_saleoff BOOLEAN NOT NULL DEFAULT 0
)ENGINE=InnoDB DEFAULT CHARSET=latin1;
最后加上了一句,里面的InnoDB、latin1改成你自己的。
一些关于查看和修改字符集的Mysql知识:
查看mysql的字符集:
show variables where Variable_name like "%char%";
查看某一个数据库字符集:
show create database enterprises;(注:enterprises为数据库)
查看某一个数据表字符集:
show create table employees;(注:employees为数据表)
修改mysql的字符集:
mysql> set character_set_client=utf8;
mysql> set character_set_connection=utf8;
mysql> set character_set_database=utf8;
mysql> set character_set_results=utf8;
mysql> set character_set_server=utf8;
mysql> set character_set_system=utf8;
mysql> set collation_connection=utf8;
mysql> set collation_database=utf8;
mysql> set collation_server=utf8;
修改数据库enterprises的字符集:
alter database enterprises character set utf8;
修改数据表employees的字符集:
alter table employees character set utf8;
修改字段的字符集:
alter table employees change name name char(10) character set utf-8;
--结束END--
本文标题: MYSQL写入数据时报错ERROR 1366 (HY000): Incorrect string value: 'xE8x8BxB1xE5xAFxB8...' fo
本文链接: https://lsjlt.com/news/5873.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0