更改MySql数据库的默认编码格式
一、设置数据库编码
安装mysql时可选择编码,如果已经安装过,可以更改文件my.ini(此文件在mysql的安装目录下)中的配制以达到目的;打开文件找到两处:
[client]
port=3306
[mysql]
default-character-set=gb2312
# The default character set that will be used when a new
schema or table is
# created and
no character set is defined
default-character-set=gb2312
更改红色部分为gb2312
此时新建数据库后,数据库目录下有个db.opt文件,内容如下:
default-character-set=gb2312
default-collation=gb2312_chinese_ci
编码数据库一致
二、客户端工具编码
编码设置与数据库
编码相同,可以用客户端工具直接写入数据,不产生乱码;
三、web.config中设置
连接字符串中的编码,MySQL
Connector Net 5.0.3用
<
connectionStrings
>
<
add
name
="MySqlServer"
connectionString
="Data Source=127.0.0.1;User
ID=root;Password=123;DataBase=BOOK;Charset=gb2312"
/>
</
connectionStrings
>
读取写入的编码
<
globalization
responseEncoding
="gb2312"
requestEncoding
="gb2312"
/>
相关文档:
自从认识mysql的那天起就知道varchar的长度限制为255,不过现在这种情况已经改变了:
Values in VARCHAR columns are variable-length strings. The length can be specified as a value from 0 to 65,535. The effective maximum length of a VARCHAR is subject to the maximum row size (65,535 by ......
关键字: mysql常用操作基本操作
MySQL常用操作基本操作,以下都是MySQL5.0下测试通过首先说明下,记住在每个命令结束时加上;(分号)
1.导出整个数据库
mysqldump -u 用户名 -p --default-character-set=latin1 数据库名 > 导出的文件名(数据库默认编码是latin1)
mysqldump -u wcnc -p smgp_apps_wcnc > wcnc. ......
昨天,我突然想把一个数据库里的每个表,以及每个表的非空总纪录数存在另一个表里面。
首先,创建了一个存放数据的表:
create table tables
(
name varchar(50),
number int
);
insert into tables select table_name from information_schema.tables where table_shema = 'test';
但是不知道有没有方法,将非空的 ......
by ZaraByte
How to do a SQL Injection for MYSQL Server 5.0+
1. Find a vulnerable add a ‘ at the end of the site example: news.php?id=1 add a ‘ at the end of the 1 and see if you get a syntax error
2. order by #–
Keep upping the # until you get an error.
3. union all select 1 ......
MSSQL:select Right(sys.fn_VarBinToHexStr(hashbytes('MD5', '123456')),32)
MSSQL16位:select Right(sys.fn_VarBinToHexStr(hashbytes('MD5', '123456')),16)
MySQL:select md5('123456')
.NET:string 结果字符串=System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFil ......