显示标签为“MySql”的博文。显示所有博文
显示标签为“MySql”的博文。显示所有博文

2009年8月18日星期二

编译Mysql时configure: error: No curses/termcap library found 的错误解决方法

问题:在手动编译安装mysql的过程中.发生错误如下:

configure: error: No curses/termcap library found

在网上找了很多的解决办法,发现以下这个正解,放上以备查用



解决方法:安装 ncurses-devel-5.5-24.20060715.i386.rpm

OK!

注意版本问题,也许我们两个需要安装的版本不一样.

2009年5月8日星期五

MYSQL--my.cnf配置中文详解

MYSQL--my.cnf配置中文详解

basedir = path 使用给定目录作为根目录(安装目录)。

character-sets-dir = path 给出存放着字符集的目录。

datadir = path 从给定目录读取数据库文件。

pid-file = filename 为mysqld程序指定一个存放进程ID的文件(仅适用于UNIX/Linux系统); Init-V脚本需要使用这个文件里的进程ID结束mysqld进程。

socket = filename 为MySQL客户程序与服务器之间的本地通信指定一个套接字文件(仅适用于UNIX/Linux系统; 默认设置一般是/var/lib/mysql/mysql.sock文件)。在Windows环境下,如果MySQL客户与服务器是通过命名管道进行通信 的,--sock选项给出的将是该命名管道的名字(默认设置是MySQL)。

lower_case_table_name = 1/0 新目录和数据表的名字是否只允许使用小写字母; 这个选项在Windows环境下的默认设置是1(只允许使用小写字母)。


mysqld程序--语言设置
引用
character-sets-server = name 新数据库或数据表的默认字符集。为了与MySQL的早期版本保持兼容,这个字符集也可以用--default-character-set选项给出; 但这个选项已经显得有点过时了。

collation-server = name 新数据库或数据表的默认排序方式。

lanuage = name 用指定的语言显示出错信息。


mysqld程序--通信、网络、信息安全
引用
enable-named-pipes 允许Windows 2000/XP环境下的客户和服务器使用命名管道(named pipe)进行通信。这个命名管道的默认名字是MySQL,但可以用--socket选项来改变。

local-infile [=0] 允许/禁止使用LOAD DATA LOCAL语句来处理本地文件。

myisam-recover [=opt1, opt2, ...] 在启动时自动修复所有受损的MyISAM数据表。这个选项的可取值有4种:DEFAULT、BACKUP、QUICK和FORCE; 它们与myisamchk程序的同名选项作用相同。

old-passwords 使用MySQL 3.23和4.0版本中的老算法来加密mysql数据库里的密码(默认使用MySQL 4.1版本开始引入的新加密算法)。

port = n 为MySQL程序指定一个TCP/IP通信端口(通常是3306端口)。

safe-user-create 只有在mysql.user数据库表上拥有INSERT权限的用户才能使用GRANT命令; 这是一种双保险机制(此用户还必须具备GRANT权限才能执行GRANT命令)。

shared-memory 允许使用内存(shared memory)进行通信(仅适用于Windows)。

shared-memory-base-name = name 给共享内存块起一个名字(默认的名字是MySQL)。

skip-grant-tables 不使用mysql数据库里的信息来进行访问控制(警告:这将允许用户任何用户去修改任何数据库)。

skip-host-cache 不使用高速缓存区来存放主机名和IP地址的对应关系。

skip-name-resovle 不把IP地址解析为主机名; 与访问控制(mysql.user数据表)有关的检查全部通过IP地址行进。

skip-networking 只允许通过一个套接字文件(Unix/Linux系统)或通过命名管道(Windows系统)进行本地连接,不允许ICP/IP连接; 这提高了安全性,但阻断了来自网络的外部连接和所有的Java客户程序(Java客户即使在本地连接里也使用TCP/IP)。

user = name mysqld程序在启动后将在给定UNIX/Linux账户下执行; mysqld必须从root账户启动才能在启动后切换到另一个账户下执行; mysqld_safe脚本将默认使用--user=mysql选项来启动mysqld程序。


mysqld程序--内存管理、优化、查询缓存区
引用
bulk_insert_buffer_size = n 为一次插入多条新记录的INSERT命令分配的缓存区长度(默认设置是8M)。

key_buffer_size = n 用来存放索引区块的RMA值(默认设置是8M)。

join_buffer_size = n 在参加JOIN操作的数据列没有索引时为JOIN操作分配的缓存区长度(默认设置是128K)。

max_heap_table_size = n HEAP数据表的最大长度(默认设置是16M); 超过这个长度的HEAP数据表将被存入一个临时文件而不是驻留在内存里。

max_connections = n MySQL服务器同时处理的数据库连接的最大数量(默认设置是100)。

query_cache_limit = n 允许临时存放在查询缓存区里的查询结果的最大长度(默认设置是1M)。

query_cache_size = n 查询缓存区的最大长度(默认设置是0,不开辟查询缓存区)。

query_cache_type = 0/1/2 查询缓存区的工作模式:0, 禁用查询缓存区; 1,启用查询缓存区(默认设置); 2,"按需分配"模式,只响应SELECT SQL_CACHE命令。

read_buffer_size = n 为从数据表顺序读取数据的读操作保留的缓存区的长度(默认设置是128KB); 这个选项的设置值在必要时可以用SQL命令SET SESSION read_buffer_size = n命令加以改变。

read_rnd_buffer_size = n 类似于read_buffer_size选项,但针对的是按某种特定顺序(比如使用了ORDER BY子句的查询)输出的查询结果(默认设置是256K)。

sore_buffer = n 为排序操作分配的缓存区的长度(默认设置是2M); 如果这个缓存区太小,则必须创建一个临时文件来进行排序。

table_cache = n 同时打开的数据表的数量(默认设置是64)。

tmp_table_size = n 临时HEAP数据表的最大长度(默认设置是32M); 超过这个长度的临时数据表将被转换为MyISAM数据表并存入一个临时文件。


mysqld程序--日志
引用
log [= file] 把所有的连接以及所有的SQL命令记入日志(通用查询日志); 如果没有给出file参数,MySQL将在数据库目录里创建一个hostname.log文件作为这种日志文件(hostname是服务器的主机名)。

log-slow-queries [= file] 把执行用时超过long_query_time变量值的查询命令记入日志(慢查询日志); 如果没有给出file参数,MySQL将在数据库目录里创建一个hostname-slow.log文件作为这种日志文件(hostname是服务器主机 名)。

long_query_time = n 慢查询的执行用时上限(默认设置是10s)。

long_queries_not_using_indexs 把慢查询以及执行时没有使用索引的查询命令全都记入日志(其余同--log-slow-queries选项)。

log-bin [= filename] 把对数据进行修改的所有SQL命令(也就是INSERT、UPDATE和DELETE命令)以二进制格式记入日志(二进制变更日志,binary update log)。这种日志的文件名是filename.n或默认的hostname.n,其中n是一个6位数字的整数(日志文件按顺序编号)。

log-bin-index = filename 二进制日志功能的索引文件名。在默认情况下,这个索引文件与二进制日志文件的名字相同,但后缀名是.index而不是.nnnnnn。

max_binlog_size = n 二进制日志文件的最大长度(默认设置是1GB)。在前一个二进制日志文件里的信息量超过这个最大长度之前,MySQL服务器会自动提供一个新的二进制日志文件接续上。

binlog-do-db = dbname 只把给定数据库里的变化情况记入二进制日志文件,其他数据库里的变化情况不记载。如果需要记载多个数据库里的变化情况,就必须在配置文件使用多个本选项来设置,每个数据库一行。

binlog-ignore-db = dbname 不把给定数据库里的变化情况记入二进制日志文件。

sync_binlog = n 每经过n次日志写操作就把日志文件写入硬盘一次(对日志信息进行一次同步)。n=1是最安全的做法,但效率最低。默认设置是n=0,意思是由操作系统来负责二进制日志文件的同步工作。

log-update [= file] 记载出错情况的日志文件名(出错日志)。这种日志功能无法禁用。如果没有给出file参数,MySQL会使用hostname.err作为种日志文件的名字。


mysqld程序--镜像(主控镜像服务器)
引用
server-id = n 给服务器分配一个独一无二的ID编号; n的取值范围是1~2的32次方启用二进制日志功能。

log-bin = name 启用二进制日志功能。这种日志的文件名是filename.n或默认的hostname.n,其中的n是一个6位数字的整数(日志文件顺序编号)。

binlog-do/ignore-db = dbname 只把给定数据库里的变化情况记入二进制日志文件/不把给定的数据库里的变化记入二进制日志文件。


mysqld程序--镜像(从属镜像服务器)
引用
server-id = n 给服务器分配一个唯一的ID编号

log-slave-updates 启用从属服务器上的日志功能,使这台计算机可以用来构成一个镜像链(A->B->C)。

master-host = hostname 主控服务器的主机名或IP地址。如果从属服务器上存在mater.info文件(镜像关系定义文件),它将忽略此选项。

master-user = replicusername 从属服务器用来连接主控服务器的用户名。如果从属服务器上存在mater.info文件,它将忽略此选项。

master-password = passwd 从属服务器用来连接主控服务器的密码。如果从属服务器上存在mater.info文件,它将忽略此选项。

master-port = n 从属服务器用来连接主控服务器的TCP/IP端口(默认设置是3306端口)。

master-connect-retry = n 如果与主控服务器的连接没有成功,则等待n秒(s)后再进行管理方式(默认设置是60s)。如果从属服务器存在mater.info文件,它将忽略此选项。

master-ssl-xxx = xxx 对主、从服务器之间的SSL通信进行配置。

read-only = 0/1 0: 允许从属服务器独立地执行SQL命令(默认设置); 1: 从属服务器只能执行来自主控服务器的SQL命令。

read-log-purge = 0/1 1: 把处理完的SQL命令立刻从中继日志文件里删除(默认设置); 0: 不把处理完的SQL命令立刻从中继日志文件里删除。

replicate-do-table = dbname.tablename 与--replicate-do-table选项的含义和用法相同,但数据库和数据库表名字里允许出现通配符"%" (例如: test%.%--对名字以"test"开头的所有数据库里的所以数据库表进行镜像处理)。

replicate-do-db = name 只对这个数据库进行镜像处理。

replicate-ignore-table = dbname.tablename 不对这个数据表进行镜像处理。

replicate-wild-ignore-table = dbn.tablen 不对这些数据表进行镜像处理。

replicate-ignore-db = dbname 不对这个数据库进行镜像处理。

replicate-rewrite-db = db1name > db2name 把主控数据库上的db1name数据库镜像处理为从属服务器上的db2name数据库。

report-host = hostname 从属服务器的主机名; 这项信息只与SHOW SLAVE HOSTS命令有关--主控服务器可以用这条命令生成一份从属服务器的名单。

slave-compressed-protocol = 1 主、从服务器使用压缩格式进行通信--如果它们都支持这么做的话。

slave-skip-errors = n1, n2, ...或all 即使发生出错代码为n1、n2等的错误,镜像处理工作也继续进行(即不管发生什么错误,镜像处理工作也继续进行)。如果配置得当,从属服务器不应该在执行 SQL命令时发生错误(在主控服务器上执行出错的SQL命令不会被发送到从属服务器上做镜像处理); 如果不使用slave-skip-errors选项,从属服务器上的镜像工作就可能因为发生错误而中断,中断后需要有人工参与才能继续进行。


mysqld--InnoDB--基本设置、表空间文件
引用
skip-innodb 不加载InnoDB数据表驱动程序--如果用不着InnoDB数据表,可以用这个选项节省一些内存。

innodb-file-per-table 为每一个新数据表创建一个表空间文件而不是把数据表都集中保存在中央表空间里(后者是默认设置)。该选项始见于MySQL 4.1。

innodb-open-file = n InnoDB数据表驱动程序最多可以同时打开的文件数(默认设置是300)。如果使用了

innodb-file-per-table选项并且需要同时打开很多数据表的话,这个数字很可能需要加大。

innodb_data_home_dir = p InnoDB主目录,所有与InnoDB数据表有关的目录或文件路径都相对于这个路径。在默认的情况下,这个主目录就是MySQL的数据目录。

innodb_data_file_path = ts 用来容纳InnoDB为数据表的表空间: 可能涉及一个以上的文件; 每一个表空间文件的最大长度都必须以字节(B)、兆字节(MB)或千兆字节(GB)为单位给出; 表空间文件的名字必须以分号隔开; 最后一个表空间文件还可以带一个autoextend属性和一个最大长度(max:n)。例如,ibdata1:1G; ibdata2:1G:autoextend:max:2G的意思是: 表空间文件ibdata1的最大长度是1GB,ibdata2的最大长度也是1G,但允许它扩充到2GB。除文件名外,还可以用硬盘分区的设置名来定义表 空间,此时必须给表空间的最大初始长度值加上newraw关键字做后缀,给表空间的最大扩充长度值加上raw关键字做后缀(例如/dev/hdb1: 20Gnewraw或/dev/hdb1:20Graw); MySQL 4.0及更高版本的默认设置是ibdata1:10M:autoextend。

innodb_autoextend_increment = n 带有autoextend属性的表空间文件每次加大多少兆字节(默认设置是8MB)。这个属性不涉及具体的数据表文件,那些文件的增大速度相对是比较小的。

innodb_lock_wait_timeout = n 如果某个事务在等待n秒(s)后还没有获得所需要的资源,就使用ROLLBACK命令放弃这个事务。这项设置对于发现和处理未能被InnoDB数据表驱动 程序识别出来的死锁条件有着重要的意义。这个选项的默认设置是50s。

innodb_fast_shutdown 0/1 是否以最快的速度关闭InnoDB,默认设置是1,意思是不把缓存在INSERT缓存区的数据写入数据表,那些数据将在MySQL服务器下次启动时再写入 (这么做没有什么风险,因为INSERT缓存区是表空间的一个组成部分,数据不会丢失)。把这个选项设置为0反面危险,因为在计算机关闭时,InnoDB 驱动程序很可能没有足够的时间完成它的数据同步工作,操作系统也许会在它完成数据同步工作之前强行结束InnoDB,而这会导致数据不完整。


mysqld程序--InnoDB--日志
引用
innodb_log_group_home_dir = p 用来存放InnoDB日志文件的目录路径(如ib_logfile0、ib_logfile1等)。在默认的情况下,InnoDB驱动程序将使用MySQL数据目录作为自己保存日志文件的位置。

innodb_log_files_in_group = n 使用多少个日志文件(默认设置是2)。InnoDB数据表驱动程序将以轮转方式依次填写这些文件; 当所有的日志文件都写满以后,之后的日志信息将写入第一个日志文件的最大长度(默认设置是5MB)。这个长度必须以MB(兆字节)或GB(千兆字节)为单 位进行设置。

innodb_flush_log_at_trx_commit = 0/1/2 这个选项决定着什么时候把日志信息写入日志文件以及什么时候把这些文件物理地写(术语称为"同步")到硬盘上。设置值0的意思是每隔一秒写一次日志并进行 同步,这可以减少硬盘写操作次数,但可能造成数据丢失; 设置值1(设置设置)的意思是在每执行完一条COMMIT命令就写一次日志并进行同步,这可以防止数据丢失,但硬盘写操作可能会很频繁; 设置值2是一般折衷的办法,即每执行完一条COMMIT命令写一次日志,每隔一秒进行一次同步。

innodb_flush_method = x InnoDB日志文件的同步办法(仅适用于UNIX/Linux系统)。这个选项的可取值有两种: fdatasync,用fsync()函数进行同步; O_DSYNC,用O_SYNC()函数进行同步。

innodb_log_archive = 1 启用InnoDB驱动程序的archive(档案)日志功能,把日志信息写入ib_arch_log_n文件。启用这种日志功能在InnoDB与 MySQL一起使用时没有多大意义(启用MySQL服务器的二进制日志功能就足够用了)。


mysqld程序--InnoDB--缓存区的设置和优化
引用
innodb_log_buffer_pool_size = n 为InnoDB数据表及其索引而保留的RAM内存量(默认设置是8MB)。这个参数对速度有着相当大的影响,如果计算机上只运行有 MySQL/InnoDB数据库服务器,就应该把全部内存的80%用于这个用途。

innodb_log_buffer_size = n 事务日志文件写操作缓存区的最大长度(默认设置是1MB)。

innodb_additional_men_pool_size = n 为用于内部管理的各种数据结构分配的缓存区最大长度(默认设置是1MB)。

innodb_file_io_threads = n I/O操作(硬盘写操作)的最大线程个数(默认设置是4)。

innodb_thread_concurrency = n InnoDB驱动程序能够同时使用的最大线程个数(默认设置是8)。


mysqld程序--其它选项
引用
bind-address = ipaddr MySQL服务器的IP地址。如果MySQL服务器所在的计算机有多个IP地址,这个选项将非常重要。

default-storage-engine = type 新数据表的默认数据表类型(默认设置是MyISAM)。这项设置还可以通过--default-table-type选项来设置。

default-timezone = name 为MySQL服务器设置一个地理时区(如果它与本地计算机的地理时区不一样)。

ft_min_word_len = n 全文索引的最小单词长度工。这个选项的默认设置是4,意思是在创建全文索引时不考虑那些由3个或更少的字符构建单词。

Max-allowed-packet = n 客户与服务器之间交换的数据包的最大长度,这个数字至少应该大于客户程序将要处理的最大BLOB块的长度。这个选项的默认设置是1MB。

Sql-mode = model1, mode2, ... MySQL将运行在哪一种SQL模式下。这个选项的作用是让MySQL与其他的数据库系统保持最大程度的兼容。这个选项的可取值包括ansi、db2、 oracle、no_zero_date、pipes_as_concat。


注意:如果在配置文件里给出的某个选项是mysqld无法识别的,MySQL服务器将不启动。

MYSQL出错信息表

mysql出错了,以前往往靠猜.有了这张表,一查就出来了.方便不少.特共享于众
1005:创建表失败
1006:创建数据库失败
1007:数据库已存在,创建数据库失败
1008:数据库不存在,删除数据库失败
1009:不能删除数据库文件导致删除数据库失败
1010:不能删除数据目录导致删除数据库失败
1011:删除数据库文件失败
1012:不能读取系统表中的记录
1020:记录已被其他用户修改
1021:硬盘剩余空间不足,请加大硬盘可用空间
1022:关键字重复,更改记录失败
1023:关闭时发生错误
1024:读文件错误
1025:更改名字时发生错误
1026:写文件错误
1032:记录不存在
1036:数据表是只读的,不能对它进行修改
1037:系统内存不足,请重启数据库或重启服务器
1038:用于排序的内存不足,请增大排序缓冲区
1040:已到达数据库的最大连接数,请加大数据库可用连接数
1041:系统内存不足
1042:无效的主机名
1043:无效连接
1044:当前用户没有访问数据库的权限
1045:不能连接数据库,用户名或密码错误
1048:字段不能为空
1049:数据库不存在
1050:数据表已存在
1051:数据表不存在
1054:字段不存在
1065:无效的SQL语句,SQL语句为空
1081:不能建立Socket连接
1114:数据表已满,不能容纳任何记录
1116:打开的数据表太多
1129:数据库出现异常,请重启数据库
1130:连接数据库失败,没有连接数据库的权限
1133:数据库用户不存在
1141:当前用户无权访问数据库
1142:当前用户无权访问数据表
1143:当前用户无权访问数据表中的字段
1146:数据表不存在
1147:未定义用户对数据表的访问权限
1149:SQL语句语法错误
1158:网络错误,出现读错误,请检查网络连接状况
1159:网络错误,读超时,请检查网络连接状况
1160:网络错误,出现写错误,请检查网络连接状况
1161:网络错误,写超时,请检查网络连接状况
1062:字段值重复,入库失败
1169:字段值重复,更新记录失败
1177:打开数据表失败
1180:提交事务失败
1181:回滚事务失败
1203:当前用户和数据库建立的连接已到达数据库的最大连接数,请增大可用的数据库连接数或重启数据库
1205:加锁超时
1211:当前用户没有创建用户的权限
1216:外键约束检查失败,更新子表记录失败
1217:外键约束检查失败,删除或修改主表记录失败
1226:当前用户使用的资源已超过所允许的资源,请重启数据库或重启服务器
1227:权限不足,您无权进行此操作
1235:MySQL版本过低,不具有本功能


第二部分 新4.1.11,摘自DOCSmysqld_error.txt

character-set=utf-8 isher补充


#define ER_HASHCHK 1000
"hashchk",

#define ER_NISAMCHK 1001
"isamchk",

#define ER_NO 1002
"NO",

#define ER_YES 1003
"YES",

#define ER_CANT_CREATE_FILE 1004
"Can't create file '%-.64s' (errno: %d)",

#define ER_CANT_CREATE_TABLE 1005
"Can't create table '%-.64s' (errno: %d)",

#define ER_CANT_CREATE_DB 1006
"Can't create database '%-.64s' (errno: %d)",

#define ER_DB_CREATE_EXISTS 1007
"Can't create database '%-.64s'; database exists",

#define ER_DB_DROP_EXISTS 1008
"Can't drop database '%-.64s'; database doesn't exist",

#define ER_DB_DROP_DELETE 1009
"Error dropping database (can't delete '%-.64s', errno: %d)",

#define ER_DB_DROP_RMDIR 1010
"Error dropping database (can't rmdir '%-.64s', errno: %d)",

#define ER_CANT_DELETE_FILE 1011
"Error on delete of '%-.64s' (errno: %d)",

#define ER_CANT_FIND_SYSTEM_REC 1012
"Can't read record in system table",

#define ER_CANT_GET_STAT 1013
"Can't get status of '%-.64s' (errno: %d)",

#define ER_CANT_GET_WD 1014
"Can't get working directory (errno: %d)",

#define ER_CANT_LOCK 1015
"Can't lock file (errno: %d)",

#define ER_CANT_OPEN_FILE 1016
"Can't open file: '%-.64s' (errno: %d)",

#define ER_FILE_NOT_FOUND 1017
"Can't find file: '%-.64s' (errno: %d)",

#define ER_CANT_READ_DIR 1018
"Can't read dir of '%-.64s' (errno: %d)",

#define ER_CANT_SET_WD 1019
"Can't change dir to '%-.64s' (errno: %d)",

#define ER_CHECKREAD 1020
"Record has changed since last read in table '%-.64s'",

#define ER_DISK_FULL 1021
"Disk full (%s). Waiting for someone to free some space...",

#define ER_DUP_KEY 1022
"Can't write, duplicate key in table '%-.64s'",

#define ER_ERROR_ON_CLOSE 1023
"Error on close of '%-.64s' (errno: %d)",

#define ER_ERROR_ON_READ 1024
"Error reading file '%-.64s' (errno: %d)",

#define ER_ERROR_ON_RENAME 1025
"Error on rename of '%-.64s' to '%-.64s' (errno: %d)",

#define ER_ERROR_ON_WRITE 1026
"Error writing file '%-.64s' (errno: %d)",

#define ER_FILE_USED 1027
"'%-.64s' is locked against change",

#define ER_FILSORT_ABORT 1028
"So瘀牡?剕????o鸞?rt aborted",

#define ER_FORM_NOT_FOUND 1029
"View '%-.64s' doesn't exist for '%-.64s'",

#define ER_GET_ERRNO 1030
"Got error %d from storage engine",

#define ER_ILLEGAL_HA 1031
"Table storage engine for '%-.64s' doesn't have this option",

#define ER_KEY_NOT_FOUND 1032
"Can't find record in '%-.64s'",

#define ER_NOT_FORM_FILE 1033
"Incorrect information in file: '%-.64s'",

#define ER_NOT_KEYFILE 1034
"Incorrect key file for table: '%-.64s'; try to repair it",

#define ER_OLD_KEYFILE 1035
"Old key file for table '%-.64s'; repair it!",

#define ER_OPEN_AS_READONLY 1036
"Table '%-.64s' is read only",

#define ER_OUTOFMEMORY 1037
"Out of memory. Restart daemon and try again (needed %d bytes)",

#define ER_OUT_OF_SORTMEMORY 1038
"Out of sort memory. Increase daemon sort buffer size",

#define ER_UNEXPECTED_EOF 1039
"Unexpected eof found when reading file '%-.64s' (errno: %d)",

#define ER_CON_COUNT_ERROR 1040
"Too many connections",

#define ER_OUT_OF_RESOURCES 1041
"Out of memory; Check if mysqld or some other process uses all available memory. If not you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space",

#define ER_BAD_HOST_ERROR 1042
"Can't get hostname for your address",

#define ER_HANDSHAKE_ERROR 1043
"Bad handshake",

#define ER_DBACCESS_DENIED_ERROR 1044
"Access denied for user: '%-.32s'@'%-.64s' to database '%-.64s'",

#define ER_ACCESS_DENIED_ERROR 1045
"Access denied for user: '%-.32s'@'%-.64s' (Using password: %s)",

#define ER_NO_DB_ERROR 1046
"No Database Selected",

#define ER_UNKNOWN_COM_ERROR 1047
"Unknown command",

#define ER_BAD_NULL_ERROR 1048
"Column '%-.64s' cannot be null",

#define ER_BAD_DB_ERROR 1049
"Unknown database '%-.64s'",

#define ER_TABLE_EXISTS_ERROR 1050
"Table '%-.64s' already exists",

#define ER_BAD_TABLE_ERROR 1051
"Unknown table '%-.64s'",

#define ER_NON_UNIQ_ERROR 1052
"Column: '%-.64s' in %-.64s is ambiguous",

#define ER_SERVER_SHUTDOWN 1053
"Server shutdown in progress",

#define ER_BAD_FIELD_ERROR 1瘀牡?剕????o鸞?054
"Unknown column '%-.64s' in '%-.64s'",

#define ER_WRONG_FIELD_WITH_GROUP 1055
"'%-.64s' isn't in GROUP BY",

#define ER_WRONG_GROUP_FIELD 1056
"Can't group on '%-.64s'",

#define ER_WRONG_SUM_SELECT 1057
"Statement has sum functions and columns in same statement",

#define ER_WRONG_VALUE_COUNT 1058
"Column count doesn't match value count",

#define ER_TOO_LONG_IDENT 1059
"Identifier name '%-.100s' is too long",

#define ER_DUP_FIELDNAME 1060
"Duplicate column name '%-.64s'",

#define ER_DUP_KEYNAME 1061
"Duplicate key name '%-.64s'",

#define ER_DUP_ENTRY 1062
"Duplicate entry '%-.64s' for key %d",

#define ER_WRONG_FIELD_SPEC 1063
"Incorrect column specifier for column '%-.64s'",

#define ER_PARSE_ERROR 1064
"%s near '%-.80s' at line %d",

#define ER_EMPTY_QUERY 1065
"Query was empty",

#define ER_NONUNIQ_TABLE 1066
"Not unique table/alias: '%-.64s'",

#define ER_INVALID_DEFAULT 1067
"Invalid default value for '%-.64s'",

#define ER_MULTIPLE_PRI_KEY 1068
"Multiple primary key defined",

#define ER_TOO_MANY_KEYS 1069
"Too many keys specified; max %d keys allowed",

#define ER_TOO_MANY_KEY_PARTS 1070
"Too many key parts specified. Max %d parts allowed",

#define ER_TOO_LONG_KEY 1071
"Specified key was too long; max key length is %d bytes",

#define ER_KEY_COLUMN_DOES_NOT_EXITS 1072
"Key column '%-.64s' doesn't exist in table",

#define ER_BLOB_USED_AS_KEY 1073
"BLOB column '%-.64s' can't be used in key specification with the used table type",

#define ER_TOO_BIG_FIELDLENGTH 1074
"Too big column length for column '%-.64s' (max = %d). Use BLOB instead",

#define ER_WRONG_AUTO_KEY 1075
"Incorrect table definition; There can only be one auto column and it must be defined as a key",

#define ER_READY 1076
"%s: ready for connections.
Version: '%s' socket: '%s' port: %d
",

#define ER_NORMAL_SHUTDOWN 1077
"%s: Normal shutdown
",

#define ER_GOT_SIGNAL 1078
"%s: Got signal %d. Aborting!
",

#define ER_SHUTDOWN_COMPLETE 1079
"%s: Shutdown Complete
",

#define ER_FORCING_CLOSE 1080
"%s: 瘀牡?剕????o鸞?Forcing close of thread %ld user: '%-.32s'
",

#define ER_IPSOCK_ERROR 1081
"Can't create IP socket",

#define ER_NO_SUCH_INDEX 1082
"Table '%-.64s' has no index like the one used in CREATE INDEX. Recreate the table",

#define ER_WRONG_FIELD_TERMINATORS 1083
"Field separator argument is not what is expected. Check the manual",

#define ER_BLOBS_AND_NO_TERMINATED 1084
"You can't use fixed rowlength with BLOBs. Please use 'fields terminated by'",

#define ER_TEXTFILE_NOT_READABLE 1085
"The file '%-.64s' must be in the database directory or be readable by all",

#define ER_FILE_EXISTS_ERROR 1086
"File '%-.80s' already exists",

#define ER_LOAD_INFO 1087
"Records: %ld Deleted: %ld Skipped: %ld Warnings: %ld",

#define ER_ALTER_INFO 1088
"Records: %ld Duplicates: %ld",

#define ER_WRONG_SUB_KEY 1089
"Incorrect sub part key. The used key part isn't a string, the used length is longer than the key part or the storage engine doesn't support unique sub keys",

#define ER_CANT_REMOVE_ALL_FIELDS 1090
"You can't delete all columns with ALTER TABLE. Use DROP TABLE instead",

#define ER_CANT_DROP_FIELD_OR_KEY 1091
"Can't DROP '%-.64s'. Check that column/key exists",

#define ER_INSERT_INFO 1092
"Records: %ld Duplicates: %ld Warnings: %ld",

#define ER_UPDATE_TABLE_USED 1093
"You can't specify target table '%-.64s' for update in FROM clause",

#define ER_NO_SUCH_THREAD 1094
"Unknown thread id: %lu",

#define ER_KILL_DENIED_ERROR 1095
"You are not owner of thread %lu",

#define ER_NO_TABLES_USED 1096
"No tables used",

#define ER_TOO_BIG_SET 1097
"Too many strings for column %-.64s and SET",

#define ER_NO_UNIQUE_LOGFILE 1098
"Can't generate a unique log-filename %-.64s.(1-999)
",

#define ER_TABLE_NOT_LOCKED_FOR_WRITE 1099
"Table '%-.64s' was locked with a READ lock and can't be updated",

#define ER_TABLE_NOT_LOCKED 1100
"Table '%-.64s' was not locked with LOCK TABLES",

#define ER_BLOB_CANT_HAVE_DEFAULT 1101
"BLOB/TEXT column '%-.64s' can't have a default value",

#define ER_WRONG_DB_NAME 1102
"Incorre瘀牡?剕????o鸞?ct database name '%-.100s'",

#define ER_WRONG_TABLE_NAME 1103
"Incorrect table name '%-.100s'",

#define ER_TOO_BIG_SELECT 1104
"The SELECT would examine more rows than MAX_JOIN_SIZE. Check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=
# if the SELECT is ok",

#define ER_UNKNOWN_ERROR 1105
"Unknown error",

#define ER_UNKNOWN_PROCEDURE 1106
"Unknown procedure '%-.64s'",

#define ER_WRONG_PARAMCOUNT_TO_PROCEDURE 1107
"Incorrect parameter count to procedure '%-.64s'",

#define ER_WRONG_PARAMETERS_TO_PROCEDURE 1108
"Incorrect parameters to procedure '%-.64s'",

#define ER_UNKNOWN_TABLE 1109
"Unknown table '%-.64s' in %-.32s",

#define ER_FIELD_SPECIFIED_TWICE 1110
"Column '%-.64s' specified twice",

#define ER_INVALID_GROUP_FUNC_USE 1111
"Invalid use of group function",

#define ER_UNSUPPORTED_EXTENSION 1112
"Table '%-.64s' uses an extension that doesn't exist in this MySQL version",

#define ER_TABLE_MUST_HAVE_COLUMNS 1113
"A table must have at least 1 column",

#define ER_RECORD_FILE_FULL 1114
"The table '%-.64s' is full",

#define ER_UNKNOWN_CHARACTER_SET 1115
"Unknown character set: '%-.64s'",

#define ER_TOO_MANY_TABLES 1116
"Too many tables. MySQL can only use %d tables in a join",

#define ER_TOO_MANY_FIELDS 1117
"Too many columns",

#define ER_TOO_BIG_ROWSIZE 1118
"Too big row size. The maximum row size for the used table type, not counting BLOBs, is %ld. You have to change some fields to TEXT or BLOBs",

#define ER_STACK_OVERRUN 1119
"Thread stack overrun: Used: %ld of a %ld stack. Use 'mysqld -O thread_stack=
#' to specify a bigger stack if needed",

#define ER_WRONG_OUTER_JOIN 1120
"Cross dependency found in OUTER JOIN. Examine your ON conditions",

#define ER_NULL_COLUMN_IN_INDEX 1121
"Column '%-.64s' is used with UNIQUE or INDEX but is not defined as NOT NULL",

#define ER_CANT_FIND_UDF 1122
"Can't load function '%-.64s'",

#define ER_CANT_INITIALIZE_UDF 1123
"Can't initialize function '%-.64s'; %-.80s",

#define ER_UDF_NO_PATHS 1124
"No paths allowed for shared瘀牡?剕????o鸞? liary",

#define ER_UDF_EXISTS 1125
"Function '%-.64s' already exist",

#define ER_CANT_OPEN_LIBRARY 1126
"Can't open shared liary '%-.64s' (errno: %d %-.64s)",

#define ER_CANT_FIND_DL_ENTRY 1127
"Can't find function '%-.64s' in liary'",

#define ER_FUNCTION_NOT_DEFINED 1128
"Function '%-.64s' is not defined",

#define ER_HOST_IS_BLOCKED 1129
"Host '%-.64s' is blocked because of many connection errors. Unblock with 'mysqladmin flush-hosts'",

#define ER_HOST_NOT_PRIVILEGED 1130
"Host '%-.64s' is not allowed to connect to this MySQL server",

#define ER_PASSWORD_ANONYMOUS_USER 1131
"You are using MySQL as an anonymous users and anonymous users are not allowed to change passwords",

#define ER_PASSWORD_NOT_ALLOWED 1132
"You must have privileges to update tables in the mysql database to be able to change passwords for others",

#define ER_PASSWORD_NO_MATCH 1133
"Can't find any matching row in the user table",

#define ER_UPDATE_INFO 1134
"Rows matched: %ld Changed: %ld Warnings: %ld",

#define ER_CANT_CREATE_THREAD 1135
"Can't create a new thread (errno %d). If you are not out of available memory, you can consult the manual for a possible OS-dependent bug",

#define ER_WRONG_VALUE_COUNT_ON_ROW 1136
"Column count doesn't match value count at row %ld",

#define ER_CANT_REOPEN_TABLE 1137
"Can't reopen table: '%-.64s'",

#define ER_INVALID_USE_OF_NULL 1138
"Invalid use of NULL value",

#define ER_REGEXP_ERROR 1139
"Got error '%-.64s' from regexp",

#define ER_MIX_OF_GROUP_FUNC_AND_FIELDS 1140
"Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is illegal if there is no GROUP BY clause",

#define ER_NONEXISTING_GRANT 1141
"There is no such grant defined for user '%-.32s' on host '%-.64s'",

#define ER_TABLEACCESS_DENIED_ERROR 1142
"%-.16s command denied to user: '%-.32s'@'%-.64s' for table '%-.64s'",

#define ER_COLUMNACCESS_DENIED_ERROR 1143
"%-.16s command denied to user: '%-.32s'@'%-.64s' for column '%-.64s' in table '%-.64s'",

#define ER_ILLEGAL_GRANT_FOR_TABLE 1144
"I瘀牡?剕????o鸞?llegal GRANT/REVOKE command. Please consult the manual which privileges can be used",

#define ER_GRANT_WRONG_HOST_OR_USER 1145
"The host or user argument to GRANT is too long",

#define ER_NO_SUCH_TABLE 1146
"Table '%-.64s.%-.64s' doesn't exist",

#define ER_NONEXISTING_TABLE_GRANT 1147
"There is no such grant defined for user '%-.32s' on host '%-.64s' on table '%-.64s'",

#define ER_NOT_ALLOWED_COMMAND 1148
"The used command is not allowed with this MySQL version",

#define ER_SYNTAX_ERROR 1149
"You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use",

#define ER_DELAYED_CANT_CHANGE_LOCK 1150
"Delayed insert thread couldn't get requested lock for table %-.64s",

#define ER_TOO_MANY_DELAYED_THREADS 1151
"Too many delayed threads in use",

#define ER_ABORTING_CONNECTION 1152
"Aborted connection %ld to db: '%-.64s' user: '%-.32s' (%-.64s)",

#define ER_NET_PACKET_TOO_LARGE 1153
"Got a packet bigger than 'max_allowed_packet'",

#define ER_NET_READ_ERROR_FROM_PIPE 1154
"Got a read error from the connection pipe",

#define ER_NET_FCNTL_ERROR 1155
"Got an error from fcntl()",

#define ER_NET_PACKETS_OUT_OF_ORDER 1156
"Got packets out of order",

#define ER_NET_UNCOMPRESS_ERROR 1157
"Couldn't uncompress communication packet",

#define ER_NET_READ_ERROR 1158
"Got an error reading communication packets",

#define ER_NET_READ_INTERRUPTED 1159
"Got timeout reading communication packets",

#define ER_NET_ERROR_ON_WRITE 1160
"Got an error writing communication packets",

#define ER_NET_WRITE_INTERRUPTED 1161
"Got timeout writing communication packets",

#define ER_TOO_LONG_STRING 1162
"Result string is longer than max_allowed_packet",

#define ER_TABLE_CANT_HANDLE_BLOB 1163
"The used table type doesn't support BLOB/TEXT columns",

#define ER_TABLE_CANT_HANDLE_AUTO_INCREMENT 1164
"The used table type doesn't support AUTO_INCREMENT columns",

#define ER_DELAYED_INSERT_TABLE_LOCKED 1165
"INSERT DELAYED can't be used with table '%-.64s瘀牡?剕????o鸞?' because it is locked with LOCK TABLES",

#define ER_WRONG_COLUMN_NAME 1166
"Incorrect column name '%-.100s'",

#define ER_WRONG_KEY_COLUMN 1167
"The used storage engine can't index column '%-.64s'",

#define ER_WRONG_MRG_TABLE 1168
"All tables in the MERGE table are not identically defined",

#define ER_DUP_UNIQUE 1169
"Can't write, because of unique constraint, to table '%-.64s'",

#define ER_BLOB_KEY_WITHOUT_LENGTH 1170
"BLOB/TEXT column '%-.64s' used in key specification without a key length",

#define ER_PRIMARY_CANT_HAVE_NULL 1171
"All parts of a PRIMARY KEY must be NOT NULL; If you need NULL in a key, use UNIQUE instead",

#define ER_TOO_MANY_ROWS 1172
"Result consisted of more than one row",

#define ER_REQUIRES_PRIMARY_KEY 1173
"This table type requires a primary key",

#define ER_NO_RAID_COMPILED 1174
"This version of MySQL is not compiled with RAID support",

#define ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE 1175
"You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column",

#define ER_KEY_DOES_NOT_EXITS 1176
"Key '%-.64s' doesn't exist in table '%-.64s'",

#define ER_CHECK_NO_SUCH_TABLE 1177
"Can't open table",

#define ER_CHECK_NOT_IMPLEMENTED 1178
"The storage engine for the table doesn't support %s",

#define ER_CANT_DO_THIS_DURING_AN_TRANSACTION 1179
"You are not allowed to execute this command in a transaction",

#define ER_ERROR_DURING_COMMIT 1180
"Got error %d during COMMIT",

#define ER_ERROR_DURING_ROLLBACK 1181
"Got error %d during ROLLBACK",

#define ER_ERROR_DURING_FLUSH_LOGS 1182
"Got error %d during FLUSH_LOGS",

#define ER_ERROR_DURING_CHECKPOINT 1183
"Got error %d during CHECKPOINT",

#define ER_NEW_ABORTING_CONNECTION 1184
"Aborted connection %ld to db: '%-.64s' user: '%-.32s' host: `%-.64s' (%-.64s)",

#define ER_DUMP_NOT_IMPLEMENTED 1185
"The storage engine for the table does not support binary table dump",

#define ER_FLUSH_MASTER_BINLOG_CLOSED 1186
"Binlog closed, cannot RESET MASTER",

#define ER_INDEX_REBUILD 1187
"Faile瘀牡?剕????o鸞?d rebuilding the index of dumped table '%-.64s'",

#define ER_MASTER 1188
"Error from master: '%-.64s'",

#define ER_MASTER_NET_READ 1189
"Net error reading from master",

#define ER_MASTER_NET_WRITE 1190
"Net error writing to master",

#define ER_FT_MATCHING_KEY_NOT_FOUND 1191
"Can't find FULLTEXT index matching the column list",

#define ER_LOCK_OR_ACTIVE_TRANSACTION 1192
"Can't execute the given command because you have active locked tables or an active transaction",

#define ER_UNKNOWN_SYSTEM_VARIABLE 1193
"Unknown system variable '%-.64s'",

#define ER_CRASHED_ON_USAGE 1194
"Table '%-.64s' is marked as crashed and should be repaired",

#define ER_CRASHED_ON_REPAIR 1195
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",

#define ER_WARNING_NOT_COMPLETE_ROLLBACK 1196
"Some non-transactional changed tables couldn't be rolled back",

#define ER_TRANS_CACHE_FULL 1197
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again",

#define ER_SLAVE_MUST_STOP 1198
"This operation cannot be performed with a running slave, run STOP SLAVE first",

#define ER_SLAVE_NOT_RUNNING 1199
"This operation requires a running slave, configure slave and do START SLAVE",

#define ER_BAD_SLAVE 1200
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",

#define ER_MASTER_INFO 1201
"Could not initialize master info structure, more error messages can be found in the MySQL error log",

#define ER_SLAVE_THREAD 1202
"Could not create slave thread, check system resources",

#define ER_TOO_MANY_USER_CONNECTIONS 1203
"User %-.64s has already more than 'max_user_connections' active connections",

#define ER_SET_CONSTANTS_ONLY 1204
"You may only use constant expressions with SET",

#define ER_LOCK_WAIT_TIMEOUT 1205
"Lock wait timeout exceeded; Try restarting transaction",

#define ER_LOCK_TABLE_FULL 1206
"The total number of locks exceeds the lock table size",

#define ER_READ_ONLY_TRANSACTION 1207瘀牡?剕????o鸞?
"Update locks cannot be acquired during a READ UNCOMMITTED transaction",

#define ER_DROP_DB_WITH_READ_LOCK 1208
"DROP DATABASE not allowed while thread is holding global read lock",

#define ER_CREATE_DB_WITH_READ_LOCK 1209
"CREATE DATABASE not allowed while thread is holding global read lock",

#define ER_WRONG_ARGUMENTS 1210
"Wrong arguments to %s",

#define ER_NO_PERMISSION_TO_CREATE_USER 1211
"'%-.32s'@'%-.64s' is not allowed to create new users",

#define ER_UNION_TABLES_IN_DIFFERENT_DIR 1212
"Incorrect table definition; all MERGE tables must be in the same database",

#define ER_LOCK_DEADLOCK 1213
"Deadlock found when trying to get lock; Try restarting transaction",

#define ER_TABLE_CANT_HANDLE_FT 1214
"The used table type doesn't support FULLTEXT indexes",

#define ER_CANNOT_ADD_FOREIGN 1215
"Cannot add foreign key constraint",

#define ER_NO_REFERENCED_ROW 1216
"Cannot add or update a child row: a foreign key constraint fails",

#define ER_ROW_IS_REFERENCED 1217
"Cannot delete or update a parent row: a foreign key constraint fails",

#define ER_CONNECT_TO_MASTER 1218
"Error connecting to master: %-.128s",

#define ER_QUERY_ON_MASTER 1219
"Error running query on master: %-.128s",

#define ER_ERROR_WHEN_EXECUTING_COMMAND 1220
"Error when executing command %s: %-.128s",

#define ER_WRONG_USAGE 1221
"Wrong usage of %s and %s",

#define ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT 1222
"The used SELECT statements have a different number of columns",

#define ER_CANT_UPDATE_WITH_READLOCK 1223
"Can't execute the query because you have a conflicting read lock",

#define ER_MIXING_NOT_ALLOWED 1224
"Mixing of transactional and non-transactional tables is disabled",

#define ER_DUP_ARGUMENT 1225
"Option '%s' used twice in statement",

#define ER_USER_LIMIT_REACHED 1226
"User '%-.64s' has exceeded the '%s' resource (current value: %ld)",

#define ER_SPECIFIC_ACCESS_DENIED_ERROR 1227
"Access denied. You need the %-.128s privilege for this operation",

#define ER_LOCAL_VARIABLE 1228
"Variable '%-.64s' 瘀牡?剕????o鸞?is a SESSION variable and can't be used with SET GLOBAL",

#define ER_GLOBAL_VARIABLE 1229
"Variable '%-.64s' is a GLOBAL variable and should be set with SET GLOBAL",

#define ER_NO_DEFAULT 1230
"Variable '%-.64s' doesn't have a default value",

#define ER_WRONG_VALUE_FOR_VAR 1231
"Variable '%-.64s' can't be set to the value of '%-.64s'",

#define ER_WRONG_TYPE_FOR_VAR 1232
"Wrong argument type to variable '%-.64s'",

#define ER_VAR_CANT_BE_READ 1233
"Variable '%-.64s' can only be set, not read",

#define ER_CANT_USE_OPTION_HERE 1234
"Wrong usage/placement of '%s'",

#define 1235
"This version of MySQL doesn't yet support '%s'",

#define ER_MASTER_FATAL_ERROR_READING_BINLOG 1236
"Got fatal error %d: '%-.128s' from master when reading data from binary log",

#define ER_SLAVE_IGNORED_TABLE 1237
"Slave SQL thread ignored the query because of replicate-*-table rules",

#define ER_INCORRECT_GLOBAL_LOCAL_VAR 1238
"Variable '%-.64s' is a %s variable",

#define ER_WRONG_FK_DEF 1239
"Wrong foreign key definition for '%-.64s': %s",

#define ER_KEY_REF_DO_NOT_MATCH_TABLE_REF 1240
"Key reference and table reference doesn't match",

#define ER_OPERAND_COLUMNS 1241
"Operand should contain %d column(s)",

#define ER_SUBQUERY_NO_1_ROW 1242
"Subquery returns more than 1 row",

#define ER_UNKNOWN_STMT_HANDLER 1243
"Unknown prepared statement handler (%ld) given to %s",

#define ER_CORRUPT_HELP_DB 1244
"Help database is corrupt or does not exist",

#define ER_CYCLIC_REFERENCE 1245
"Cyclic reference on subqueries",

#define ER_AUTO_CONVERT 1246
"Converting column '%s' from %s to %s",

#define ER_ILLEGAL_REFERENCE 1247
"Reference '%-.64s' not supported (%s)",

#define ER_DERIVED_MUST_HAVE_ALIAS 1248
"Every derived table must have it's own alias",

#define ER_SELECT_REDUCED 1249
"Select %u was reduced during optimisation",

#define ER_TABLENAME_NOT_ALLOWED_HERE 1250
"Table '%-.64s' from one of SELECT's can not be used in %-.32s",

#define ER_NOT_SUPPORTED_AUTH_MODE 1251
"Client does not support authentication pr瘀牡?剕????o鸞?otocol requested by server; consider upgrading MySQL client",

#define ER_SPATIAL_CANT_HAVE_NULL 1252
"All parts of a SPATIAL KEY must be NOT NULL",

#define ER_COLLATION_CHARSET_MISMATCH 1253
"COLLATION '%s' is not valid for CHARACTER SET '%s'",

#define ER_SLAVE_WAS_RUNNING 1254
"Slave is already running",

#define ER_SLAVE_WAS_NOT_RUNNING 1255
"Slave has already been stopped",

#define ER_TOO_BIG_FOR_UNCOMPRESS 1256
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)",

#define ER_ZLIB_Z_MEM_ERROR 1257
"ZLIB: Not enough memory",

#define ER_ZLIB_Z_BUF_ERROR 1258
"ZLIB: Not enough room in the output buffer (probably, length of uncompressed data was corrupted)",

#define ER_ZLIB_Z_DATA_ERROR 1259
"ZLIB: Input data corrupted",

#define ER_CUT_VALUE_GROUP_CONCAT 1260
"%d line(s) was(were) cut by group_concat()",

#define ER_WARN_TOO_FEW_RECORDS 1261
"Row %ld doesn't contain data for all columns",

#define ER_WARN_TOO_MANY_RECORDS 1262
"Row %ld was truncated; It contained more data than there were input columns",

#define ER_WARN_NULL_TO_NOTNULL 1263
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld",

#define ER_WARN_DATA_OUT_OF_RANGE 1264
"Data truncated, out of range for column '%s' at row %ld",

#define ER_WARN_DATA_TRUNCATED 1265
"Data truncated for column '%s' at row %ld",

#define ER_WARN_USING_OTHER_HANDLER 1266
"Using storage engine %s for table '%s'",

#define ER_CANT_AGGREGATE_2COLLATIONS 1267
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",

#define ER_DROP_USER 1268
"Can't drop one or more of the requested users",

#define ER_REVOKE_GRANTS 1269
"Can't revoke all privileges, grant for one or more of the requested users",

#define ER_CANT_AGGREGATE_3COLLATIONS 1270
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",

#define ER_CANT_AGGREGATE_NCOLLATIONS 1271
"Illegal mix of collations for operation '%s'",

#define ER_VARIABLE_IS_NOT_STRUCT 1272
"Variable '%-.64s' is瘀牡?剕????o鸞? not a variable component (Can't be used as XXXX.variable_name)",

#define ER_UNKNOWN_COLLATION 1273
"Unknown collation: '%-.64s'",

#define ER_SLAVE_IGNORED_SSL_PARAMS 1274
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support; they can be used later when MySQL slave with SSL will be started",

#define ER_SERVER_IS_IN_SECURE_AUTH_MODE 1275
"Server is running in --secure-auth mode, but '%s'@'%s' has a password in the old format; please change the password to the new format",

#define ER_WARN_FIELD_RESOLVED 1276
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT
#%d was resolved in SELECT
#%d",

#define ER_BAD_SLAVE_UNTIL_COND 1277
"Wrong parameter or combination of parameters for START SLAVE UNTIL",

#define ER_MISSING_SKIP_SLAVE 1278
"It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL. Otherwise you will get problems if you get an unexpected slave's mysqld restart",

#define ER_UNTIL_COND_IGNORED 1279
"SQL thread is not to be started so UNTIL options are ignored",

#define ER_WRONG_NAME_FOR_INDEX 1280
"Incorrect index name '%-.100s'",

#define ER_WRONG_NAME_FOR_CATALOG 1281
"Incorrect catalog name '%-.100s'",

#define ER_WARN_QC_RESIZE 1282
"Query cache failed to set size %lu, new query cache size is %lu",

#define ER_BAD_FT_COLUMN 1283
"Column '%-.64s' cannot be part of FULLTEXT index",

#define ER_UNKNOWN_KEY_CACHE 1284
"Unknown key cache '%-.100s'",

#define ER_WARN_HOSTNAME_WONT_WORK 1285
"MySQL is started in --skip-name-resolve mode. You need to restart it without this switch for this grant to work",

#define ER_UNKNOWN_STORAGE_ENGINE 1286
"Unknown table engine '%s'",

#define ER_WARN_DEPRECATED_SYNTAX 1287
"'%s' is deprecated, use '%s' instead",

#define ER_NON_UPDATABLE_TABLE 1288
"The target table %-.100s of the %s is not updatable",

#define ER_FEATURE_DISABLED 1289
"The '%s' feature was disabled; you need MySQL built with '%s' to have it working",

#define ER_OPTION_PREVENTS_STATEME瘀牡?剕????o鸞?NT 1290
"The MySQL server is running with the %s option so it cannot execute this statement",

#define ER_DUPLICATED_VALUE_IN_TYPE 1291
"Column '%-.100s' has duplicated value '%-.64s' in %s"

#define ER_TRUNCATED_WRONG_VALUE 1292
"Truncated wrong %-.32s value: '%-.128s'"

#define ER_TOO_MUCH_AUTO_TIMESTAMP_COLS 1293
"Incorrect table definition; There can only be one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause"

#define ER_INVALID_ON_UPDATE 1294
"Invalid ON UPDATE clause for '%-.64s' field",

#define ER_UNSUPPORTED_PS 1295
"This command is not supported in the prepared statement protocol yet",

MySQL安装错误:/usr/local/mysql/libexec/mysqld: unknown option '--skip-federated'

MySQL安装错误:/usr/local/mysql/libexec/mysqld: unknown option '--skip-federated'

今天在CentOS4.7和5.2下源码安装MySQL5.1.34出现如下错误

Installing MySQL system tables...
[ERROR] /usr/local/mysql/libexec/mysqld: unknown option '--skip-federated'
[ERROR] Aborting
[Note] /usr/local/mysql/libexec/mysqld: Shutdown complete

只要将/etc/my.cnf文件中的skip-federated注释掉即可

2009年4月24日星期五

APACHE-PHP-MYSQL-ZEND

先声明,我绝对是个Linux的菜鸟,以下的这些文字个人的安装笔记,是参考了网上许多高手的成功经验组合而成的,说实话我自己的东西不多 :)我想把这些经验写下来,既可以对其他跟我一样摸索的兄弟一个经验,也可以防止以后自己都忘记了,嘿嘿。

所以如果某个大虾看到我借用了你的资源,请你不要生气。也欢迎大家进行指点。

1、下载centos 4.4
我是下载的DVD版本,大家也可以下载服务器CD安装版本,其实都差不多。大家可以到这儿下载,速度很快的。
http://ftp.iasi.roedu.net/mirrors/centos.org/4.4/isos/i386/

下载后当然就刻录成光盘。我建议你刻录DVD啦,如果是菜鸟,也可以在图形界面进行学习,不会这么抓不住头脑。

2、(1)安装CentOS4.4
作为服务器,不安装不需要的组件,所以在选择组件的时候,除了选择FTP SERVER外取消所有组件的选择。也不要选web服务器。因为我们后面要手动编译安装。


系统约定RPM包和源码包存放位置

RPM包和源码包存放位置 /usr/local/src
源码包编译安装位置(prefix) /usr/local/xxx
脚本以及维护程序存放位置 /usr/local/sbin
MySQL 数据库位置 /var/lib/mysql
Apache 网站根目录 /home/www
Apache 虚拟主机日志根目录 /data/logs/www
yum RPM包信息文件 /etc/yum.list

(2)更新系统,此处我们使用up2date,先修改up2date镜像。
vi /etc/sysconfig/rhn/sources

我把源修改成这样了:

yum centos4-Base http://mirror.be10.com/centos/4/os/$ARCH/
yum centos4-Updates http://mirror.be10.com/centos/4/updates/$ARCH/
yum centos4-extras http://mirror.be10.com/centos/4/extras/$ARCH/
yum centos4-contrib http://mirror.be10.com/centos/4/contrib/$ARCH/
yum centos4-addons http://mirror.be10.com/centos/4/addons/$ARCH/
yum centos4-centosplus http://mirror.be10.com/centos/4/centosplus/$ARCH/

然后执行:
# up2date -l //列出更新
# up2date -uf //更新包括版本的所有程序。如果不包括内核,则用up2date -u


3、系统环境部署及调整

(1). 检查系统是否正常
# more /var/log/messages //检查有无系统内核级错误信息
# demesg //检查硬件设备是否有错误信息
# ifconfig //检查网卡设置是否正确
# ping www.163.com // 检查网络是否正常

(2). 关闭不需要的服务
# export LANG='en_US' //设置语言
# setup //选择启动的服务
进入system service 选项。
以space 键选定所需服务。
以下仅列出需要启动的服务,未列出的服务一律关闭:
crond
irqbalance 仅当服务器CPU为S.M.P架构或支持双核心、HT技术时,才需开启,否则关闭。
microcode_ctl
network
vsftpd
sshd
syslog

(3)、修改/etc/yum.repos.d/CentOS-Base.repo,将镜象站点地址改为在中国的镜象站点地址。不然我们通过yum安装软件速度会极慢。修改如下:

# CentOS-Base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
baseurl=http://mirror.vmmatrix.net/CentOS/$releasever/os/$basearch/
http://mirror.be10.com/centos/$releasever/os/$basearch/
http://centos.hostlink.com.hk/$releasever/os/$basearch/
http://ftp.hostrino.com/pub/centos/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

#released updates
[update]
name=CentOS-$releasever - Updates
baseurl=http://mirror.vmmatrix.net/CentOS/$releasever/os/$basearch/
http://mirror.be10.com/centos/$releasever/os/$basearch/
http://centos.hostlink.com.hk/$releasever/os/$basearch/
http://ftp.hostrino.com/pub/centos/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
baseurl=http://mirror.vmmatrix.net/CentOS/$releasever/os/$basearch/
http://mirror.be10.com/centos/$releasever/os/$basearch/
http://centos.hostlink.com.hk/$releasever/os/$basearch/
http://ftp.hostrino.com/pub/centos/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirror.vmmatrix.net/CentOS/$releasever/os/$basearch/
http://mirror.be10.com/centos/$releasever/os/$basearch/
http://centos.hostlink.com.hk/$releasever/os/$basearch/
http://ftp.hostrino.com/pub/centos/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

保存。

然后导入key升级相应yum数据

# rpm --import /usr/share/doc/centos-release-4/RPM-GPG-KEY-centos4
# yum list tee /etc/yum.list //读取yum list 数据,将其输出到 /etc/yum.list。


(4)、定时校正服务器时间
# yum install ntp
# crontab -e
0 23 * * * root /usr/sbin/ntpdate 210.72.145.44 > /dev/null 2>&1

以上命令设置好后存盘。您的机器将在每天的23:00根据中国国家授时中心的NTP服务器时间自动校准时间。

(5). 对TCP/IP网络参数进行调整,加强抗SYN Flood能力
# echo 'net.ipv4.tcp_syncookies = 1' >> /etc/sysctl.conf //将net.ipv4.tcp_syncookies = 1写入sysctl.conf 文件
# sysctl -p //查看

(6)、FTP服务器的配置
vi /etc/vsftpd/vsftpd.conf
把anonymous_enable=YES注释掉不允许匿名登录。
把chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
前的注释去掉。
把ftpd_banner=*前的注释去掉。后面改成你的欢迎信息(这样设置可以避免显示ftp服务器的版本信息)
然后保存,service vsftpd start就可以了。

这时应当添加用户,因为root默认不能通过FTP方式登录。

# adduser username
# passwd userpassword

这样对于我们上传一些文件到系统中很方便。


4. 重新启动系统
# init 6


5. 使用 yum 程序安装所需开发包(以下为标准的 RPM 包名称)
# yum install gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel

#这里我们将编译GD所必须的一些小软件比如libpng,libtiff,freetype,libjpeg等先用RPM的方式一并安装好,避免手动编译浪费时间,同时也能避免很多错误,这几个小软件的编译很麻烦。这几个小软件编译错误了,GD当然安装不了,php5的编译当然也没戏了。所以我们抓大放小,对这些小牛鬼蛇神采取快速简洁的方式进行安装。并且对服务器的性能也不能产生什么影响。

6. 源码编译安装所需包 (Source)
(1) GD2
# cd /usr/local/src
# wget http://www.boutell.com/gd/http/gd-2.0.33.tar.gz
# tar xzvf gd-2.0.33.tar.gz
# cd gd-2.0.33
# ./configure --prefix=/usr/local/gd2 --mandir=/usr/share/man //./configure 配置。
# make //make 是用来编译的,它从 Makefile 中读取指令,然后编译。
# make install //make install 是用来安装的,它也从 Makefile 中读取指令,安装到指定的位置。

(2) Apache 日志截断程序
# cd /usr/local/src
# wget http://cronolog.org/download/cronolog-1.6.2.tar.gz
# tar xzvf cronolog-1.6.2.tar.gz
# cd cronolog-1.6.2
# ./configure --prefix=/usr/local/cronolog
# make
# make install

(3) libxml 库程序
# cd /usr/local/src
# wget http://ftp.gnome.org/pub/gnome/sources/libxml2/2.6/libxml2-2.6.26.tar.gz
# tar zxvf libxml2-2.6.26.tar.gz
# cd libxml2-2.6.26
# ./configure --prefix=/usr/local/libxml2
# make
# make install

7、编译mysql 5.0.33

cd /usr/local/src
# wget http://mysql.oss.eznetsols.org/Downloads/MySQL-5.0/mysql-5.0.33.tar.gz
# tar xzvf mysql-5.0.33.tar.gz
# cd mysql-5.0.33

修改mysql 客户端最大连接数, 默认的只有100,远远达不到我们的要求。

# vi sql/mysqld.cc

搜索找到下面一行:
{"max_connections", OPT_MAX_CONNECTIONS,
"The number of simultaneous clients allowed.", (gptr*) &max_connections,
(gptr*) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 100, 1, 16384, 0, 1,
0},

将其中的100改为1500, 当然小点也可以,根据你的需要来,不建议改的太大。

{"max_connections", OPT_MAX_CONNECTIONS,
"The number of simultaneous clients allowed.", (gptr*) &max_connections,
(gptr*) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 1500, 1, 16384, 0, 1,
0},

保存。

# CHOST="i686-pc-linux-gnu" CFLAGS="-O3 -msse2 -mmmx -mfpmath=sse -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer" CXXFLAGS="-O3 -msse2 -mmmx -mfpmath=sse -funroll-loops -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer" ./configure --prefix=/usr/local/mysql --localstatedir=/var/lib/mysql --with-comment=Source --with-server-suffix=-Community-Server --with-mysqld-user=mysql --without-debug --with-big-tables --with-charset=latin1 --with-collation=latin1_swedish_ci --with-extra-charsets=all --with-pthread --enable-static --enable-thread-safe-client --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --enable-assembler --without-innodb --without-ndb-debug --without-isam


配置成功会提示:

MySQL has a Web site at http://www.mysql.com/ which carries details on the
latest release, upcoming features, and other information to make your
work or play with MySQL more productive. There you can also find
information about mailing lists for MySQL discussion.

Remember to check the platform specific part of the reference manual for
hints about installing MySQL on your platform. Also have a look at the
files in the Docs directory.

Thank you for choosing MySQL!

// 注意 ,CHOST="i686-pc-linux-gnu" CFLAGS="-O3 -msse2 -mmmx -mfpmath=sse -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer" CXXFLAGS="-O3 -msse2 -mmmx -mfpmath=sse -funroll-loops -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer" 这个环境参数只针对intel P4 芯片,如果你的CPU是AMD的,注意不能使用。请查看相应的编译优化参数。否则程序会无法编译,即使编译成功也无法运行,嘿嘿。

# make
编译的时间可能会比较长,毕竟优化的比较厉害。

# make install

编译安装完成后执行后续操作:
# useradd mysql //添加 mysql 用户
# cd /usr/local/mysql
# bin/mysql_install_db --user=mysql
# chown -R root:mysql . //设置权限,注意后面有一个 "."
# chown -R mysql /var/lib/mysql //设置 mysql 目录权限
# chgrp -R mysql . //注意后面有一个 "."
# cp share/mysql/my-medium.cnf /etc/my.cnf
# cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld //开机自动启动 mysql。
# chmod 755 /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# /etc/rc.d/init.d/mysqld start //启动 MySQL
# bin/mysqladmin -u root password "password_for_root"
# service mysqld stop //关闭 MySQL

8. 编译安装 Apache
# cd /usr/local/src
# wget http://www.ip97.com/apache.org/httpd/httpd-2.2.4.tar.gz
# tar zxvf httpd-2.2.4.tar.gz
# cd httpd-2.2.4

依次安装apr和apr-util

# cd srclib/apr
# ./configure --prefix=/usr/local/apr --enable-threads --enable-other-child USE=ipv6
# make && make install

# cd ../apr-util
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/ --with-mysql=/usr/local/mysql
# make && make install

cd /usr/local/src/httpd-2.2.4
# CHOST="i686-pc-linux-gnu" CFLAGS="-O3 -msse2 -mmmx -mfpmath=sse -funroll-loops -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer" ./configure --prefix=/usr/local/apache2 --enable-mods-shared=all --enable-deflate=shared --with-mysql=/usr/local/mysql --enable-cache --enable-file-cache --enable-mem-cache --enable-disk-cache --enable-static-support --enable-static-htpasswd --enable-static-htdigest --enable-static-rotatelogs --enable-static-logresolve --enable-static-htdbm --enable-static-ab --enable-static-checkgid --disable-cgid --disable-cgi --with-mpm=worker --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --enable-ssl --with-ssl=/usr/include/openssl

# make
# make install
# echo '/usr/local/apache2/bin/apachectl start ' >> /etc/rc.local //将 apachectl 的调用加入到你的系统启动文件中。

注解:
./configure //配置源代码树
--prefix=/usr/local/apache2 //体系无关文件的顶级安装目录PREFIX ,也就Apache的安装目录。
--enable-module=so //打开 so 模块,so 模块是用来提 DSO 支持的 apache 核心模块
--enable-mods-shared=all //编译全部的模板,对于不需要我们可以在httpd.conf去掉。
--enable-cache //支持缓存
--enable-file-cache //支持文件缓存
--enable-mem-cache //支持记忆缓存
--enable-disk-cache //支持磁盘缓存
--enable-static-support //支持静态连接(默认为动态连接)
--enable-static-htpasswd //使用静态连接编译 htpasswd - 管理用于基本认证的用户文件
--enable-static-htdigest //使用静态连接编译 htdigest - 管理用于摘要认证的用户文件
--enable-static-rotatelogs //使用静态连接编译 rotatelogs - 滚动 Apache 日志的管道日志程序
--enable-static-logresolve //使用静态连接编译 logresolve - 解析 Apache 日志中的IP地址为主机名
--enable-static-htdbm //使用静态连接编译 htdbm - 操作 DBM 密码数据库
--enable-static-ab //使用静态连接编译 ab - Apache HTTP 服务器性能测试工具
--enable-static-checkgid //使用静态连接编译 checkgid
--disable-cgid //禁止用一个外部 CGI 守护进程执行CGI脚本
--disable-cgi //禁止编译 CGI 版本的 PHP
--with-mpm=worker // 让apache以worker方式运行
--enable-ssl // 编译 ssl模块。

将apache设置成开机自启动:

在/etc/rc.d/rc.local文件中加入一行
/usr/local/apache2/bin/apachectl start
这样每次重新启动系统以后,apache也会随系统一起启动.

或者
# cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
然后 vi /etc/rc.d/init.d/httpd 添加(#!/bin/sh下面)
# chkconfig: 2345 10 90
# description: Activates/Deactivates Apache Web Server
最后,运行chkconfig把Apache添加到系统的启动服务组里面:
# chkconfig --add httpd
# chkconfig httpd on


9、编译php 5.2.1并打上Suhosin Patch。
Suhosin是php增强型安全补丁,可以编译到静态内核中,也可以编译成php动态扩展。我个人强烈你建议安装成静态内核。Suhosin已经进入freebsd和gentoo的ports。下面的以下先说静态安装步骤。当然你也可以在安装php后将它编译成php的动态扩展。

# cd /usr/local/src
# wget http://cn.php.net/get/php-5.2.1.tar.gz/from/this/mirror
wget http://www.hardened-php.net/suhosin/_media/suhosin-patch-5.2.1-0.9.6.2.patch.gz
# tar zxvf php-5.2.1.tar.gz
# gunzip suhosin-patch-5.2.1-0.9.6.2.patch.gz
# cd php-5.2.1
patch -p 1 -i ../suhosin-patch-5.2.1-0.9.6.2.patch

#./buildconf --force

# CHOST="i686-pc-linux-gnu" CFLAGS="-O3 -msse2 -mmmx -mfpmath=sse -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer" CXXFLAGS="-O3 -msse2 -mmmx -mfpmath=sse -funroll-loops -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer" ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-zlib-dir --with-bz2 --with-tiff-dir --with-libxml-dir=/usr/local/libxml2 --with-gd=/usr/local/gd2 --with-freetype-dir --with-jpeg-dir --with-png-dir --with-ttf --enable-mbstring --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-config-file-path=/etc --with-iconv --disable-ipv6 --enable-static --enable-maintainer-zts --enable-memory-limit --enable-zend-multibyte --enable-inline-optimization --enable-zend-multibyte --enable-sockets --enable-soap --enable-suhosin --with-openssl

# make

# make install

# cp php.ini-recommended /etc/php.ini


在这里也顺便说一下将suhosin安装成为php的动态扩展的方法。毕竟网上根本不见它的中文安装教程。

虽然我个人不推荐这种方式。

wget http://www.hardened-php.net/suhosin/_media/suhosin-0.9.16.tgz
tar zxvf suhosin-0.9.16.tgz
cd suhosin-0.9.16
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install

会提示编译的模块存在的目录,记住它。
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/

然后在php.ini中增加一行下列语句。
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/suhosin.so

10 、整合apache 与php
# vi /usr/local/apache2/conf/httpd.conf
在最后一行加上:
AddType application/x-httpd-php .php

查找:(设置 WEB 默认文件)
DirectoryIndex index.html
替换为:
DirectoryIndex index.php index.html index.htm //在 WEB 目录不到默认文件,httpd 就会执行 /var/www/error/noindex.html

找到这一段:
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride none

更改为AllowOverride all
允许apache rewrite

# 监听443端口,支持https连接
取消注释 httpd.conf 中的 Include conf/extra/httpd-ssl.conf

保存httpd.conf,退出。

# /usr/local/apache2/bin/apachectl restart //重启 Apache

11. 查看确认 L.A.M.P 环境信息
vi /usr/local/apache2/htdocs/phpinfo.php
增加下面一行,并保存。

# chmod 755 /usr/local/apache2/htdocs/phpinfo.php

用浏览器打开 http://127.0.0.1/phpinfo.php


# echo ' ' > /usr/local/apache2/htdocs/testdb.php
# chmod 755 /usr/local/apache2/htdocs/testdb.php
# service mysqld start
用浏览器打开 http://127.0.0.1/testdb.php
检查 phpinfo 中的各项信息是否正确。

12、设置SSL并创建自己的CA

# cd /usr/share/ssl/misc

# ./CA -newca

屏幕上出现如下的提示:CA certificate filename (or enter to create)

这是要求输入要创建的CA的证书文件名, 可以直接回车或输入证书文件名。

Making CA certificate ...
Generating a 1024 bit RSA private key
.........++++++
................................++++++
writing new private key to './demoCA/private/./cakey.pem'
Enter PEM pass phrase:

Verifying password - Enter PEM pass phrase:-

此时要求输入和验证CA的私钥口令、国家代码(中国是CN)、省份、城市或地区、组织或企业名称、部门名称、CA的名称或服务器的主机名称、管理员电子邮件地址。

至此,在当前目录下生成了demoCA的目录,CA的证书就在该目录下,文件名为cacert.pem

生成服务器的证书请求

# ./CA -newreq

屏幕上出现如下的提示:

Generating a 1024 bit RSA private key
.....................................................++++++
.....++++++
writing new private key to 'newreq.pem'
Enter PEM pass phrase:
Verifying password - Enter PEM pass phrase:

此时要求输入和验证服务器的私钥口令、国家代码(中国是CN)、省份、城市或地区、组织或企业名称、部门名称、CA的名称或服务器的主机名称、管理员电子邮件地址。

Please enter the following 'extra' attributes

to be sent with your certificaterequest

A challenge password []:

An optional company name []:

.Request (and private key) is in newreq.pem

这是要求输入服务器的相关信息。

此时,在当前目录下生成了一个名为newreq.pem的文件,包含了要生成服务器数字证书的请求。

签署证书

# ./CA -sign

屏幕上出现如下的提示:

Using configuration from /usr/share/ssl/openssl.cnf

Enter PEM pass phrase:

此时一样需要输入CA的私钥口令、国家代码(中国是CN)、省份、城市或地区、组织或企业名称、部门名称、CA的名称或服务器的主机名称、管理员电子邮件地址。

Certificate is to be certified until Nov 19 13:46:19 2002 GMT (365 days)

Sign the certificate? [y/n]:y

这时显示证书请求文件中的各项信息,并询问是否要签署证书,回答y,进行签署。

1 out of 1 certificate requests certified, commit? [y/n]y

回答y,会显示已经签署的证书的信息,并在当前目录下生成服务器的证书文件newcert.pem。

# mkdir /usr/local/apache2/conf/ssl.crt/
# mkdir /usr/local/apache2/conf/ssl.key/
# cp newcert.pem /usr/local/apache2/conf/ssl.crt/server.pem
# cp newreq.pem /usr/local/apache2/conf/ssl.key/server.pem


更改服务器的证书文件的相关配置
# vi /usr/local/apache2/conf/extra/httpd-ssl.conf

查找并修改

# Server Certificate:
# Point SSLCertificateFile at a PEM encoded certificate. If
# the certificate is encrypted, then you will be prompted for a
# pass phrase. Note that a kill -HUP will prompt again. Keep
# in mind that if you have both an RSA and a DSA certificate you
# can configure both in parallel (to also allow the use of DSA
# ciphers, etc.)
SSLCertificateFile /usr/local/apache2/conf/ssl.crt/server.pem
#SSLCertificateFile /usr/local/apache2/conf/server-dsa.crt

# Server Private Key:
# If the key is not combined with the certificate, use this
# directive to point at the key file. Keep in mind that if
# you've both a RSA and a DSA private key you can configure
# both in parallel (to also allow the use of DSA ciphers, etc.)
SSLCertificateKeyFile /usr/local/apache2/conf/ssl.key/server.pem
#SSLCertificateKeyFile /usr/local/apache2/conf/server-dsa.key


示例文件

在SSL的根目录中生成一个index.html,它是如下所示:

<html>

这是SSL示例!

</html>

测试

假如Web服务器的DNS名称是www.cnprint.org.

在浏览器的URL地址栏里输入 http://www.cnprint.org/,浏览器便会显示APACHE安装时确省的Test Page.

在浏览器的URL地址栏里输入 https://www.cnprint.org/,注意:是 https 而不是http !

浏览器会提示站点已经采用了SSL进行数据的加密传输.由于我们的CA证书不是浏览器缺省的信任的根证书,所以,浏览器会说无法确认服务器的证书可信。暂时不管,一直NEXT,最后,浏览器会显示:这是SSL示例!

可以把CA的证书放在非SSL的站点上,让浏览器下载并安装CA证书,并将其设置成可信任的根证书,便可解决上面的问题.8 解除HTTPD起动时的口令输入。

由于安全的原因,Web服务器的私钥是口令加密了的,每次重新起动HTTPD或Linux时,都会要求输入Web服务器的私钥的口令。

如果要解除HTTPD起动时的口令输入,可以这样:

# cd /usr/local/apache2/conf/ssl.key/
# cp server.pem server.pem.org
# openssl rsa -in server.pem.org -out server.pem
# chmod 400 server.pem

另外在网上看到一个方法,我没有试。有兴趣的可以试下。

创建SSL密码自动应答文件,否则每次Apache启动的时候,都会要求你输入SSL的密码.
创建 /usr/local/apache2/conf/ssl.key/sendsslpwd ,内容如下.
#!/bin/bash
SSLpasswd="YOUR PASSPHRASE"
echo $SSLpasswd
chmod 755 /usr/local/apache2/conf/ssl.key/sendsslpwd


此时,Web服务器的私钥已经没有口令加密,一定要确保server.pem文件除root外,任何用户均无权读取它。


13、安装 Zend Optimizer
# cd /usr/local/src
# wget http://downloads.zend.com/optimizer/3.2.2/ZendOptimizer-3.2.2-linux-glibc21-i386.tar.gz
# tar xzvf ZendOptimizer-3.2.2-linux-glibc21-i386.tar.gz
# ./ZendOptimizer-3.2.2-linux-glibc21-i386/install.sh
按照它的提示一步步进行就行了。

14、安装eaccelerator // eaccelerator是php的加速软件,使用后php的执行效率会有较大幅度的提升。目前eaccelerator 0.9.5已经和ZendOptimizer-3.2.2能够很好兼容啦。不过我个人觉得,ZendOptimizer-3.2.2没有加速的功能,只是起到了运行zend加密文件的作用而已。闲话不多说了,大家有兴趣的,可以去google下。

# cd /usr/local/src
# wget http://bart.eaccelerator.net/source/0.9.5/eaccelerator-0.9.5.tar.bz2
# tar -jxvf eaccelerator-0.9.5.tar.bz2
# cd eaccelerator-0.9.5

export PHP_PREFIX="/usr/local/php"
$PHP_PREFIX/bin/phpize //指定一下php的目录

# ./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config // 设置

# make & make install

编译安装后我们会看到屏幕提示的eaccelerator.so所在的目录,比如我得到的是/usr/local/php/lib/php/extensions/no-debug-zts-20060613/eaccelerator.so,记住这个路径,待会要用到。

修改php.ini(安装完zend之后,php.ini存放于/usr/local/Zend/etc)
在文件最后,zend之前,注意,这部分内容务必放在zend之前,不然可能会出现不可预期的服务器问题。添加下列信息:

[eaccelerator]
extension="/usr/local/php/lib/php/extensions/no-debug-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="32"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"

解释:
zend_extension 是安装完程序自动指示给我们的
eaccelerator.shm_size="32" 缓存大小单位MB
eaccelerator.cache_dir="/tmp/eaccelerator" 缓存路径

# mkdir /tmp/eaccelerator // 建立目录
# chmod 0777 /tmp/eaccelerator // 修改目录属性

最后重新启动apachectl

重启apache,phpinfo显示:
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies
with eAccelerator v0.9.5, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
with Zend Extension Manager v1.0.11, Copyright (c) 2003-2006, by Zend Technologies
with Zend Optimizer v3.2.2, Copyright (c) 1998-2006, by Zend Technologies

也会有eAccelerator的具体信息。

15、安装phpmyadmin,管理mysql数据库

# cd /usr/local/apache2/htdocs/
# wget http://jaist.dl.sourceforge.net/sourceforge/phpmyadmin/phpMyAdmin-2.10.0-beta1-all-languages.tar.bz2

# tar jxvf phpMyAdmin-2.10.0-beta1-all-languages.tar.bz2
# mv phpMyAdmin-2.10.0-beta1-all-languages phpmyadmin

# cd phpmyadmin/libraries

修改配置文件
# vi config.default.php

找到这几行进行修改:
$cfg['Servers'][$i]['auth_type'] = 'http'; // Authentication method (valid choices: config, http, HTTP, signon or cookie)
$cfg['Servers'][$i]['user'] = 'root'; // MySQL user
$cfg['Servers'][$i]['password'] = 'PASSWORD'; // MySQL password (only needed

经过这几个步骤,我们一个比较安全的LAMP服务器就环境基本建立成功啦。感觉上也不是很难,是吧?
当然对于打造基于动态IP的网站,以上的信息还不够,还有建立ADSL拨号,NAT,动态域名更新,防火墙,安装论坛程序等一系列的工作,我会慢慢地写出自己的心得与大家分享。毕竟这对我来说,也是个学习的过程。

2009年4月7日星期二

MySql更改用户密码

有好几种方法:

1. 命令行更改:
mysqladmin password 新密码
例如, dos(或者liunx)下mysql的bin目录下,mysqladmin password 123456

2. 用MYSQL的grant语句,例如
GRANT ALL ON *.* TO 'root'@'localhost' IDENTIFIED BY '123456' WITH GRANT OPTION

3. SET PASSWORD FOR '用户名'@'主机' = PASSWORD('密码')
例如设置root密码为123456,SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');

4. UPDATE user SET Password=PASSWORD('新密码') WHERE User='用户名' AND Host = '主机';

例如,UPDATE user SET Password=PASSWORD('123456') WHERE User='root' AND Host = 'localhost';flush priviliges;