### MySQL 4.0.21 使用注意事项

MySQL 4.0.21 使用注意事项
1、max_allowed_packet = 16M，缺省为1M

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编码，不用任何设置。

jdbc:mysql://localhost/risenet?useUnicode=true&amp;characterEncoding=gb2312

4、缺省的storage engine是MyISAM，需要修改为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