Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2529190
  • 博文数量: 271
  • 博客积分: 6659
  • 博客等级: 准将
  • 技术积分: 3141
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-17 10:24
文章分类

全部博文(271)

文章存档

2016年(2)

2015年(12)

2014年(7)

2013年(19)

2012年(22)

2011年(81)

2010年(128)

分类: Mysql/postgreSQL

2010-11-04 01:20:04

-static  13%
   --with-client-ldflags=-all-static
   --with-mysqld-ldflags=-all-static
静态链接提高13%性能

 

Unix Socket  7.5%
--with-unix-socket path=/usr/local/mysql/tmp/mysql.sock


使用unix套接字链接提高7.5%性能,所以在性能肯定不如unix下面

 

--enable-assembler

The --enable-assembler options of configure allows for
compiling in x86 (and sparc) versions of common string
operations, which should result in more performance.
汇编x86的普通操作符,可以提高性能

--with-extra-charsets=complex字符支持

--enable-thread-safe-client#Compile the client with threads.也就是让客户端支持线程的意思

 

--with-big-tables

There is a limit of 232(~4.295E+09) rows in aMyISAMtable. If you build MySQL with the--with-big-tablesoption, the row limitation is increased to (232)2(1.844E+19) rows

 

--with-ssl

--with-embedded-server   #编译成embedded MySQL library (libmysqld.a),

--enable-local-infile#mysql支持从本地文件导入

load local infile '/usr/test' into table test fields terminated by ' ';
ERROR 1148 (42000): The used command
isnot allowed withthisMySQL version

 

--with-plugins=innobase存储引擎

Mysql5.1开始,编译添加innodb插件就从--with-innodb改成了--with-plugins=innobase

--with-plugins=PLUGIN[[[,PLUGIN..]]]
                                                    Plugins to include
inmysqld. (defaultis: none)
                                                    Must be a configuration name or a comma separated
                                                    list of plugins.
                                                    Available configurations are: none max max-no-ndb
                                                    all.
                                                    Available plugins are: partition daemon_example
                                                    ftexample archive blackhole csv example federated
                                                    heap innobase myisam myisammrg ndbcluster
如果多个插件,可以写成:--with-plugins=partition,blackhole,heap,innobase,myisam,ndbcluster用逗号分开

 

 

 

 

 

 

 

MySQL安装前确认以下包已经装好gcc gcc-c++ ncurses-devel

/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
tar zxvf mysql-5.4.0-beta.tar.gz
cd mysql-5.4.0-beta
CFLAGS="-O6 -mpentiumpro -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O6 -mpentiumpro -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti"
./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/var/ --with-server-suffix=-enterprise-gpl --without-debug --with-big-tables --with-extra-charsets=latin1,gb2312,big5,utf8,GBK --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 --with-federated-storage-engine
make && make install
cp support-files/my-medium.cnf /usr/local/mysql/my.cnf
/usr/local/mysql/bin/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql

 my.cnf文件记得注销--skip-federated引擎功能再启动mysql

 ./mysqld_safe --defaults-file=/usr/local/mysql/my.cnf --user=mysql &

 

mysql编译参数说明:根据./configure --help查看支持配置的参数

 

-pgcc-O6编译
CFLAGS="-O6 -mpentiumpro -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O6 -mpentiumpro -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti"
总体性能可提高10%,当然如果不是用奔腾处理器,就不必用它了,因为它是专为奔腾系统设计的

 

-static静态编译
--enable-static
--with-client-ldflags=-all-static
--with-mysqld-ldflags=-all-static
以静态方式编译客户端和服务端,能提高13%性能

 

--enable-thread-safe-client
以线程方式编译客户端

 

--without-innodb
去掉innodb表支持,innodb是一种支持事务处理的表,适合级应用

 

--without-isam
去掉isam表类型支持,现在很少用了,isam表是一种依赖平台的表

 

--without-ndb-debug
取消导航调试

 

--localstatedir=/usr/local/mysql/var/
日志文件目录

 

--with-server-suffix=-enterprise-gpl
MySQL加个后缀名,在用mysql登录的时候在版本号的后面可以看到

 

--without-debug
去除诊断模式,如果用--with-debug=full编译,大多数查询慢20%

 

--with-big-tables
大表支持

 

--with-extra-charsers=gbk,gb2312,utf8
设置支持gbk,gb2312,utf8字符集

 

--with-pthread
强制使用pthread(posix线程库)

 

--enable-assembler
使用一些字符函数来汇编版本

 

--with-federated-storage-engine
这个参数已经被废除,代替它的是--with-plugin系列

 

cp support-files/my-medium.cnf /usr/local/mysql/my.cnf
mysql/support-files
里面有配置文件范本,根据实际情况选择或者更改

 

/usr/local/mysql/bin/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql --defaults-file=/usr/local/mysql/my.cnf --pid-file=/usr/local/mysql/mysql.pid
设定默认值:默认空间路径;默认数据文件路径;默认用户;默认配置文件路径;默认PID文件路径。

 


-------------------------------------------------------

 


本脚步未加入的编译参数:

--with-charset=utf8
设置默认字符集

 

--with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
使用unix套接字链接提高7.5%性能,所以在windowsmysql性能肯定不如unix

 

--with-tcp-port=3306
指定MySQL实例将监听TCP 3306端口


阅读(2238) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-11-05 08:37:49

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com