Mysql的varchar类型
自从认识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 bytes, which is shared among all columns) and the character set used.
In contrast to CHAR, VARCHAR values are stored as a one-byte or two-byte length prefix plus data. The length prefix indicates the number of bytes in the value. A column uses one length byte if values require no more than 255 bytes, two length bytes if values may require more than 255 bytes.
...
The following table illustrates the differences between CHAR and VARCHAR by showing the result of storing various string values into CHAR(4) and VARCHAR(4) columns (assuming that the column uses a single-byte character set such as latin1).
Value
CHAR(4)
Storage Required
VARCHAR(4)
Storage Required
''
' '
4 bytes
''
1 byte
'ab'
'ab '
4 bytes
'ab'
3 bytes
'abcd'
'abcd'
4 bytes
'abcd'
5 bytes
'abcdefgh'
'abcd'
4 bytes
'abcd'
5 bytes
(http://dev.mysql.com/doc/refman/5.1/en/char.html)
以后基本可以不使用text字段了。。。。。。
相关文档:
1.登录MySQL终端 2.授权:
允许所有机器访问MySQL服务器
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH RIVILEGES;
允许指定机器访问MySQL服务器
GRANT ALL PRIVILEGES ON *.* TO 'root'@'IP地址'IDENTIFIED BY 'password' WITH GRANT OPTION; ......
Oracle函数和mysql函数比较
1. Oracle中的to_number()转换成数字;
Oracle> Select to_number(‘123’) from dual; ----- 123;
&nbs ......
update :单表的更新不用说了,两者一样,主要说说多表的更新
Oracle> Oracle的多表更新要求比较严格,所以有的时候不是很好写,我们可以试试Oracle的游标
&n ......
方法一:建一个拼音表 t_cosler ,存放每个字母开头的第一个汉字的编号和最后一个汉字的编号。
BatchFile code
+------+--------+-------+
| f_PY | cBegin | cEnd |
+------+--------+-------+
| A | 45217 | 45252 |
| B | 45253 | 45760 |
.....
| Z | 54481 | 55289 |
+------+--------+------- ......
在mysql数据库中,使用的是latin字符集,所以无法正常的支持中文字符,中文在数据库中显示为乱码“?”号。为了让mysql可以正常使用中文,尤其是当使用jsp连接mysql的时候,我们需要使用gbk的字符集,因此我们要对mysql进行以下设置,以便其有效的支持中文:
IXDBA.NET技术社区
1.修改my.cnf文件
my.cnf文件是 ......