MySQL MyIsam 存储引擎索引长度限制测试记录
MySQL MyIsam 存储引擎在创建索引的时候,索引键长度是有一个较为严格的长度限制的,所有索引键最大长度总和不能超过1000,而且不是实际数据长度的总和,而是索引键字段定义长度的总和。下面做个简单的测试,记录一下。
root@sky:~# mysql -u sky -p -h127.0.0.1
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 44
Server version: 5.0.51a-log MySQL Community Server (GPL)
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
sky@127.0.0.1 : (none) 05:23:08> use test;
Database changed
sky@127.0.0.1 : test 05:23:11>
sky@127.0.0.1 : test 05:23:12>
先创建一个MyIsam表,字符集选择latin1,三个字段均设置为varchar 255,:
sky@127.0.0.1 : test 05:23:12> create table test_ind
-> (a varchar(255),
-> b varchar(255),
-> c varchar(255)
-> ) engine=myisam charset=latin1;
Query OK, 0 rows affected (0.01 sec)
创建效果:
sky@127.0.0.1 : test 05:23:32> show create table test_ind\G
*************************** 1. row ***************************
Table: test_ind
Create Table: CREATE TABLE `test_ind` (
`a` varchar(255) default NULL,
`b` varchar(255) default NULL,
`c` varchar(255) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
三个字段联合索引(长度应该在1000以内)
sky@127.0.0.1 : test 05:23:41> create index test_a_b_c_ind on test_ind(a,b,c);
Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0
我们看到,创建成功了。
下面我们做一次字符集转换,将字符集转换成utf8
sky@127.0.0.1 : test 05:25:54> alter table test_ind convert to charset utf8;
ERROR 1071 (42000): Specified key was too long; max key length is 1000 bytes
sky@127.0.0.1 : test 05:26:24>
sky@127.0.0.1 : test 05:28:03> show create table test_ind\G
*************************** 1. row ***************************
Table: test_ind
Create Table: CREATE TABLE `test_ind` (
`a` varchar(255) default NULL,
`b` varchar(255) default NULL,
`c` varcha
相关文档:
安装时的优化
(以下测试数据都来自于mysql的官方网站)
不要用rpm或其他二进制方式安装
要用源代码自己编译
如果是奔腾系统,推荐用pgcc编译器
且使用-O6的编译参数
这样编出来的mysql比用gcc2.95的要快1%
仅用用得着的字符集编译MySql
mysql目前支持多达34种不同的字符集(mysql4.1.11)
但我们常用的也无非就是lati ......
MySQL 5.1.40已经发布,在这里有一些新的特性出现,包括MySQL基群基于磁盘的数据支持等等。 MySQL 5.1.40已经发布,这一版本的MySQL有很多新的功能特性,希望这些新特性能让大家今后的工作更有效率。MySQL是现在最流行一个多线程的,结构化查询语言(SQL)数据库服务器.绝大多数PHP网站的数据库后台都是采用这一数据库.
......
报错:
/tmp/ccBBJEB8.o: In function `ping_sql':
pingsql.c:(.text+0x7c): undefined reference to `mysql_init'
pingsql.c:(.text+0xe1): undefined reference to `mysql_real_connect'
pingsql.c:(.text+0xff): undefined reference to `mysql_close'
pingsql.c:(.text+0x119): undefined reference to `mys ......
最近上网找了一些关于备份mysql数据库的方法,主要就是通过网页的方法导出数据库的sql 文件,找到个不错的代码,但发现中文导出会乱码,于是稍微修改了一下,下面是备份的代码
view plaincopy to clipboardprint?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml ......
作者:叶金荣(Email: imysql#gmail.com),来源:http://iMySQL.cn,转载请注明作者和出处,并且不能用于商业用途,违者必究。
MySQL提供了数据库的同步功能,这对我们实现数据库的冗灾、备份、恢复、负载均衡等都是有极大帮助的。本文描述了常见的同步设置方法。
一、准备服务器
由于MySQL不同版本之间的(二进制日志)b ......