mysql 5.1 编译安装

本文介绍如何使MySQL 5.1版本支持InnoDB存储引擎,包括编译安装时添加特定参数及安装InnoDB插件的方法。此外,还提供了MySQL 5.1.39的具体安装步骤及部分性能测试数据。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

oracle 收购 innobase 后,[color=red]mysql从5.1开始就不默认支持innodb引擎了,要使用innodb必须编译时,在configrue的时候,加上--with-plugins=innobase这个参数。[/color]

这样编译安装的mysql就支持InnoDB了。
mysql> show plugin;
+------------+--------+----------------+---------+---------+
| Name | Status | Type | Library | License |
+------------+--------+----------------+---------+---------+
| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |
| CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |
| InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
+------------+--------+----------------+---------+---------+
6 rows in set, 1 warning (0.00 sec)

mysql> show engines\G
*************************** 1. row ***************************
Engine: CSV
Support: YES
Comment: CSV storage engine
Transactions: NO
XA: NO
Savepoints: NO
*************************** 2. row ***************************
Engine: MRG_MYISAM
Support: YES
Comment: Collection of identical MyISAM tables
Transactions: NO
XA: NO
Savepoints: NO
*************************** 3. row ***************************
Engine: MEMORY
Support: YES
Comment: Hash based, stored in memory, useful for temporary tables
Transactions: NO
XA: NO
Savepoints: NO
*************************** 4. row ***************************
Engine: InnoDB
Support: YES
Comment: Supports transactions, row-level locking, and foreign keys
Transactions: YES
XA: YES
Savepoints: YES
*************************** 5. row ***************************
Engine: MyISAM
Support: DEFAULT
Comment: Default engine as of MySQL 3.23 with great performance
Transactions: NO
XA: NO
Savepoints: NO
5 rows in set (0.00 sec)


也可以安装innodb团队2008年开发的[url=http://www.innodb.com/wp/2008/04/15/innodb-plugin-announced/]innodb_plugin[/url],这个plugin其实等同于innodb引擎。
我的是mysql-5.1.39.tar.gz源码包,所以已经集成进去,可以直接在configrue的时候,加上--with-plugins=innodb_plugin这个参数。一些老的5.1版本可能需要自己去[url=http://www.innodb.com/wp/products/innodb_plugin/download/]下载innodb_plugin[/url]。据别人测试mysql 5.0.45 下的 innodb 会比 5.1.24rc 下的 innodb 总体性能稍微好一些(数据仅供参考)。
那位作者的网址是:[url]http://imysql.cn/2008_04_23_mysql_5.1.24rc_and_innodb_plugin[/url]。
里面有教5.1.24rc怎么安装innodb_plugin,也有测试数据。

innodb plugin 的一些主要新特性有:
Fast index creation: add or drop indexes without copying the data
Data compression: shrink tables, to significantly reduce storage and i/o
New row format: fully off-page storage of long BLOB, TEXT, and VARCHAR columns
File format management: protects upward and downward compatibility
INFORMATION_SCHEMA tables: information about compression and locking
Other changes for flexibility, ease of use and reliability
Dynamic control of innodb_file_per_table
TRUNCATE TABLE re-creates the *.ibd file to reclaim space
“Strict mode” to prevent mistakes


根据官方提供的消息,[url=http://dev.mysql.com/tech-resources/articles/mysql-54.html]5.4的innodb的性能比5.1/5.0的提升很大[/url],期待正式版的发布。

mysql-5.1.39安装
sudo groupadd mysql
sudo useradd -g mysql mysql


Ubuntu需安装相关库
sudo apt-get install libncurses5-dev
sudo apt-get install libncursesw5-dev

RedHat这样
yum -y install ncurses-devel


安装命令
./configure --prefix=/usr/local/web/mysql --enable-assembler --with-mysqld-user=mysql --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-extra-charsets=all --with-charset=utf8 --with-collation=utf8_general_ci --enable-thread-safe-client --with-big-tables --with-plugins=innobase --without-debug
make
sudo make install-strip



sudo cp support-files/my-medium.cnf /etc/my.cnf
sudo cp support-files/mysql.server /etc/init.d/mysqld
sudo chmod 700 /etc/init.d/mysqld
sudo ./scripts/mysql_install_db --user=mysql



设置用户访问权限
cd /usr/local/web/mysql
sudo chown -R root .
sudo chown -R mysql var
sudo chown -R mysql var/.
sudo chown -R mysql var/mysql/.
sudo chgrp -R mysql .



启动设置
sudo /usr/local/web/mysql/bin/mysqld_safe --user=mysql &
sudo mysqladmin -uroot –p password newpassword
sudo mysql -uroot –pnewpassword


mysql>use mysql;
mysql>delete from user where password=""; #删除用于本机匿名连接的空密码帐号
mysql>flush privileges;
mysql>quit
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值