更改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不允许从远程访问的方法
2009-06-04 13:11
1。 改表法。可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"
Sql代码 复制代码
1. mysql -u root -pvmwaremysql>us ......
自从认识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 ......
CREATE TABLE `taa` (
`year` varchar(4) DEFAULT NULL,
`month` varchar(2) DEFAULT NULL,
`amount` double DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf
"year","m ......
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 ......