MySQL 4.0.21 使用注意事项

MySQL 4.0.21 使用注意事项
1、max_allowed_packet = 16M,缺省为1M
这涉及BLOB等最大,通常要修改。

2、没有仔细看下面这段,这在MySQL的manual.html中有。建表时要用LONGBLOB 和LONGTEXT 。
BLOB
TEXT
A BLOB or TEXT column with a maximum length of 65,535 (2^16 -1) characters.
MEDIUMBLOB
MEDIUMTEXT
A BLOB or TEXT column with a maximum length of 16,777,215 (2^24 - 1) characters.
LONGBLOB
LONGTEXT
A BLOB or TEXT column with a maximum length of 4,294,967,295 or 4GB (2^32 - 1) characters.

3、中文问题,MySQL服务器就是缺省的latin1编码,不用任何设置。
在windows中文版上,linux上没有测试过。
数据库驱动 com.mysql.jdbc.Driver (org.gjt.mm.mysql.Driver用本方法无效)
jdbc:mysql://localhost/risenet?useUnicode=true&characterEncoding=gb2312
在xml中不要直接使用“&”,需要使用XML转意字符:&

4、缺省的storage engine是MyISAM,需要修改为InnoDB。
在运行时修改可以用:set table_type=InnoDB
用show variables可以查看当前的storage engine(也就是table_type)。

将mysql.ini中的关于InnoDB的部分的注释去掉。
Uncomment the following if you are using InnoDB tables

5、建立外键时发生错误,需要先建立index才可以建立外键。在 4.1.2 及以上的版本中,将自动建立index。
If MySQL reports an error number 1005 from a CREATE TABLE statement, and the error message string refers to errno 150, this

means that the table creation failed because a foreign key constraint was not correctly formed. Similarly, if an ALTER TABLE

fails and it refers to errno 150, that means a foreign key definition would be incorrectly formed for the altered table.

Starting from MySQL 4.0.13, you can use SHOW INNODB STATUS to display a detailed explanation of the latest InnoDB foreign key

error in the server.

------------------------
LATEST FOREIGN KEY ERROR
------------------------
041024 10:48:44 Error in foreign key constraint of table `risenet/office_workflowtracking`:
There is no index in table `risenet/office_workflowtracking` where the columns appear
as the first columns. Constraint:
FOREIGN KEY (Workflow_GUID) REFERENCES Office_WorkflowDefine(Workflow_GUID)
)
See http://www.innodb.com/ibman.php for correct foreign key definition.
------------

InnoDB needs indexes on foreign keys and referenced keys so that foreign key checks can be fast and not require a table scan.

Starting with MySQL 4.1.2, these indexes are created automatically. In older versions, the indexes must be created explicitly

or the creation of foreign key constraints will fail.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值