2010年(13)
分类: Mysql/postgreSQL
2010-08-14 11:56:38
比如现在/home 为最大分区
/home 下现在又 mysql-5.1.42.tar.gz innodb_plugin-1.0.6.tar.gz两个文件
tar -zxvf mysql-5.1.42.tar.gz
mv innodb_plugin-1.0.6.tar.gz mysql-5.1.42/storage/
cd mysql-5.1.42/storage/
tar -zxvf innodb_plugin-1.0.6.tar.gz
rm -rf innobase
mv innodb_plugin-1.0.6 innobase
cd ../
./configure --prefix=/home/mysql5142 --with-mysqld-ldflags=-all-static --with-plugins=innobase --with-mysqld-user=mysql --with-charset=cp932 --with-pthread CFLAGS=-O3 CXXFLAGS=-O3 CXX=gcc
make
make install
chown -R root .
chown -R mysql var
chgrp -R mysql .
ln -s /home/mysql5142 /usr/local/mysql
/usr/local/mysql/bin/mysqld_safe --user=mysql &
mysql> show engines;
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| CSV | YES | CSV storage engine | NO | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MyISAM | YES | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
=============================================
建一个这样的文件/etc/my.cnf 内容如下:
[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer = 64M
max_allowed_packet = 128M
max_tmp_tables=128
table_cache = 64
tmp_table_size = 128M
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_concurrency = 16
thread_cache_size = 16
query_cache_size = 0
query_cache_type = 0
max_connections = 8000
max_connect_errors=100
innodb_table_locks=0
log-bin=mysql-bin
log-bin-index=mysql-bin.index
server-id = 1
sql_mode="STRICT_ALL_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
innodb_buffer_pool_size = 256M
innodb_log_buffer_size = 8M
innodb_log_file_size = 5M
innodb_file_per_table
innodb_status_file
skip-name-resolve
default_storage_engine=InnoDB
innodb_file_format=barracuda
innodb_strict_mode=1
transaction-isolation = READ-COMMITTED
binlog_format=ROW
log
######################################################################################
配置文件新参数说明:
default_storage_engine=InnoDB ##我原来的mysql有这个参数,为了保证和原来的一样这里也加上这个参数吧
innodb_file_format=barracuda ## innodb_file_format innodb_strict_mode 这两个参数是 InnoDB 以plugin形式出现后 Innodb特有的参数,官网上建议加上,barracuda 的效果是支持表数据和索引的压缩,使Innodb性能更加优越.
innodb_strict_mode=1
transaction-isolation = READ-COMMITTED
binlog_format=ROW ## mysql 5.1 中 transaction-isolation = READ-COMMITTED binlog_format 只能设置成为 ROW