innodb插件方式安装myql 5.1
yum install gcc gcc-c++
groupadd mysql
useradd --shell /sbin/nologin -g mysql mysql
tar zxvf mysql-5.1.58.tar.gz
cd mysql-5.1.58
#设置一下 CFLAGS 和 CXXFLAGS,尤其要注意打开 HAVE_DLOPEN 选项
CFLAGS='-O2 -DHAVE_DLOPEN -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector –param=ssp-buffer-size=4 -m64 -mtune=generic'
CXXFLAGS='-O2 -DHAVE_DLOPEN -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector –param=ssp-buffer-size=4 -m64 -mtune=generic'
./configure --prefix=/data1/app/services/mysql
--with-charset=utf8
--with-collation=utf8_general_ci
--with-extra-charsets=complex
--enable-thread-safe-client
--enable-local-infile
--enable-assembler
--with-big-tables
--localstatedir=/data1/app/services/mysql/data
--with-unix-socket-path=/data1/app/tmp/mysql.sock
--with-mysqld-user=mysql
--with-plugins=max-no-ndb
make
make install
cp support-files/my-medium.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysql
chmod u+x /etc/init.d/mysql
cd /data1/app/services/mysql
bin/mysql_install_db --user=mysql --force --datadir=data
chown -R root .
chown -R mysql data
chgrp -R mysql .
chkconfig --add mysql
chkconfig --level 345 mysql on
bin/mysqld_safe --user=mysql &
service mysql restart
ln -s /data1/app/mysql52/bin/mysql /sbin/mysql
ln -s /data1/app/mysql52/mysqladmin /sbin/mysqladmin
my.cnf文件参考(注意红色部分):
[mysqld]
datadir=/data1/app/services/mysql/data
socket=/data1/app/tmp/mysql.sock
pid-file=/data1/app/tmp/mysql.pid
user=mysql
port=3308
ignore-builtin-innodb
plugin-load=innodb=ha_innodb_plugin.so
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
character-set-server = utf8
collation-server = utf8_general_ci
default-storage-engine=INNODB
skip-name-resolve
skip-external-locking
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 32512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 2M
myisam_sort_buffer_size = 8M
thread_cache_size = 32
query_cache_size = 8M
tmp_table_size = 64M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 16
lower_case_table_names = 1
max_connections = 100
slow_query_log_file = /data1/app/log/mysql-slow.log
slow_query_log = 1
log-queries-not-using-indexes
long_query_time = 1
wait_timeout = 86400
log-bin = mysql-bin
server-id = 1
expire-logs-days = 7
innodb_buffer_pool_size = 256M
innodb_additional_mem_pool_size = 16M
innodb_file_per_table
innodb_open_files = 65535
innodb_lock_wait_timeout = 50
innodb_log_file_size = 512M
innodb_log_buffer_size = 16M
innodb_flush_method = O_DIRECT
innodb_flush_log_at_trx_commit = 2
binlog_format = mixed
transaction-isolation = READ-UNCOMMITTED
[mysqld_safe]
log-error=/data1/app/log/mysql.log
启动数据库进去看下:
[root@fbtw-topcity log]# mysql -h 127.0.0.1 -P 3308
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.1.58-log Source distribution
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
mysql> show plugin;
+------------+----------+----------------+---------------------+---------+
| Name | Status | Type | Library | License |
+------------+----------+----------------+---------------------+---------+
| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |
| partition | ACTIVE | STORAGE ENGINE | NULL | GPL |
| ARCHIVE | ACTIVE | STORAGE ENGINE | NULL | GPL |
| BLACKHOLE | ACTIVE | STORAGE ENGINE | NULL | GPL |
| CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |
| FEDERATED | DISABLED | STORAGE ENGINE | NULL | GPL |
| MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| InnoDB | ACTIVE | STORAGE ENGINE | ha_innodb_plugin.so | GPL |
+------------+----------+----------------+---------------------+---------+
10 rows in set, 1 warning (0.00 sec)
mysql> show variables like 'innodb_%';
+---------------------------------+------------------------+
| Variable_name | Value |
+---------------------------------+------------------------+
| innodb_adaptive_flushing | ON |
| innodb_adaptive_hash_index | ON |
| innodb_additional_mem_pool_size | 16777216 |
| innodb_autoextend_increment | 8 |
| innodb_autoinc_lock_mode | 1 |
| innodb_buffer_pool_size | 268435456 |
| innodb_change_buffering | inserts |
| innodb_checksums | ON |
| innodb_commit_concurrency | 0 |
| innodb_concurrency_tickets | 500 |
| innodb_data_file_path | ibdata1:10M:autoextend |
| innodb_data_home_dir | |
| innodb_doublewrite | ON |
| innodb_fast_shutdown | 1 |
| innodb_file_format | Antelope |
| innodb_file_format_check | Antelope |
| innodb_file_per_table | ON |
| innodb_flush_log_at_trx_commit | 2 |
| innodb_flush_method | O_DIRECT |
| innodb_force_recovery | 0 |
| innodb_io_capacity | 200 |
| innodb_lock_wait_timeout | 50 |
| innodb_locks_unsafe_for_binlog | OFF |
| innodb_log_buffer_size | 16777216 |
| innodb_log_file_size | 536870912 |
| innodb_log_files_in_group | 2 |
| innodb_log_group_home_dir | ./ |
| innodb_max_dirty_pages_pct | 75 |
| innodb_max_purge_lag | 0 |
| innodb_mirrored_log_groups | 1 |
| innodb_old_blocks_pct | 37 |
| innodb_old_blocks_time | 0 |
| innodb_open_files | 65535 |
| innodb_read_ahead_threshold | 56 |
| innodb_read_io_threads | 4 |
| innodb_replication_delay | 0 |
| innodb_rollback_on_timeout | OFF |
| innodb_spin_wait_delay | 6 |
| innodb_stats_method | nulls_equal |
| innodb_stats_on_metadata | ON |
| innodb_stats_sample_pages | 8 |
| innodb_strict_mode | OFF |
| innodb_support_xa | ON |
| innodb_sync_spin_loops | 30 |
| innodb_table_locks | ON |
| innodb_thread_concurrency | 0 |
| innodb_thread_sleep_delay | 10000 |
| innodb_use_sys_malloc | ON |
| innodb_version | 1.0.17 |
| innodb_write_io_threads | 4 |
+---------------------------------+------------------------+
50 rows in set (0.02 sec)
mysql>