Install MySQL5.5.16 on Red Hat
Enterprise Linux Server release 6.1
(Santiago)_64bit
msn:jieshiyeskey@hotmail.com
[root@mail opt]# lsb_release
-a
LSB Version:
:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID:
RedHatEnterpriseServer
Description:
Red Hat Enterprise Linux Server release 6.1 (Santiago)
Release:
6.1
Codename:
Santiago
[root@mail opt]# uname
-a
Linux mail.jieshiyeskey.com
2.6.32-131.0.15.el6.x86_64 #1 SMP Tue May 10 15:42:40 EDT 2011
x86_64 x86_64 x86_64 GNU/Linux
[root@mail opt]# tar zxvf
cmake-2.8.5.tar.gz
[root@mail opt]# cd
cmake-2.8.5
[root@mail cmake-2.8.5]#
./bootstrap
[root@mail cmake-2.8.5]#
make && make install
[root@mail ~]# groupadd
mysql
[root@mail ~]# useradd -g
mysql -s /sbin/nologin mysql
[root@mail ~]# mkdir -p
/storage/db/mysql_data
[root@mail ~]# mkdir -p
/software/mysql
[root@mail ~]# mkdir -p
/etc/mysql
[root@mail opt]# tar zxvf
mysql-5.5.16.tar.gz
[root@mail opt]# cd
mysql-5.5.16
[root@mail mysql-5.5.16]#
cmake . -DCMAKE_INSTALL_PREFIX=/software/mysql/
-DMYSQL_DATADIR=/storage/db/mysql_data
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci
-DEXTRA_CHARSETS=all
-DWITH_SSL=system -DWITH_ZLIB=system -DWITH_EMBEDDED_SERVER=1
-DENABLED_LOCAL_INFILE=1 -DWITH_MYISAM_STORAGE_ENGINE=1
-DSYSCONFDIR=/etc/mysql
-DMYSQL_TCP_PORT=7454 -DWITH_DEBUG=0
-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1
-DWITH_FEDERATED_STORAGE_ENGINE=1
-DWITH_PARTITION_STORAGE_ENGINE=1
[root@mail mysql-5.5.16]#
make && make install
[root@mail mysql-5.5.16]# cp
./support-files/my-innodb-heavy-4G.cnf /etc/mysql/my.cnf
[root@mail mysql-5.5.16]#
chown -R mysql /storage/db/mysql_data/
[root@mail mysql-5.5.16]#
chgrp -R mysql /storage/db/mysql_data/
[root@mail mysql-5.5.16]#
/software/mysql/scripts/mysql_install_db --basedir=/software/mysql/
--user=mysql --datadir=/storage/db/mysql_data/
[root@mail mysql-5.5.16]# cp
/opt/mysql-5.5.16/support-files/mysql.server
/etc/init.d/mysqld
[root@mail mysql-5.5.16]#
chmod 755 /etc/init.d/mysqld
[root@mail mysql-5.5.16]#
vim /etc/init.d/mysqld
basedir=/software/mysql
datadir=/storage/db/mysql_data
[root@mail mysql_data]#
/etc/init.d/mysqld start
Starting MySQL[ OK ]
[root@mail mysql_data]#
netstat -an |grep 7454
tcp
0
0 0.0.0.0:7454
0.0.0.0:*
LISTEN
[root@mail mysql_data]# ps
-ef |grep mysql
root
4616
1 0 03:11
pts/0
00:00:00 /bin/sh /software/mysql//bin/mysqld_safe
--datadir=/storage/db/mysql_data/
--pid-file=/storage/db/mysql_data//mail.jieshiyeskey.com.pid
mysql
5261
4616 1
03:11 pts/0
00:00:01 /software/mysql/bin/mysqld --basedir=/software/mysql
--datadir=/storage/db/mysql_data/
--plugin-dir=/software/mysql/lib/plugin --user=mysql
--log-error=/storage/db/mysql_data//mail.jieshiyeskey.com.err
--open-files-limit=8192
--pid-file=/storage/db/mysql_data//mail.jieshiyeskey.com.pid
--socket=/tmp/mysqld.sock --port=7454
root
5348
1 1 03:12
pts/0
00:00:00 /bin/sh /software/mysql//bin/mysqld_safe
--datadir=/storage/db/mysql_data/
--pid-file=/storage/db/mysql_data//mail.jieshiyeskey.com.pid
mysql
5995
5348 6
03:12 pts/0
00:00:01 /software/mysql/bin/mysqld --basedir=/software/mysql
--datadir=/storage/db/mysql_data/
--plugin-dir=/software/mysql/lib/plugin --user=mysql
--log-error=/storage/db/mysql_data//mail.jieshiyeskey.com.err
--open-files-limit=8192
--pid-file=/storage/db/mysql_data//mail.jieshiyeskey.com.pid
--socket=/tmp/mysqld.sock --port=7454
root
6036
2242 0
03:12 pts/0
00:00:00 grep mysql
[root@mail bin]# vim
/etc/profile
export
PATH=$PATH:/software/mysql/bin
[root@mail bin]# source
/etc/profile
[root@mail bin]#
mysql
Welcome to the MySQL
monitor.
Commands end with ; or \g.
Your MySQL connection id is
2
Server version: 5.5.16-log
Source distribution
Copyright (c) 2000, 2010,
Oracle and/or its affiliates. All rights reserved.
Oracle is a registered
trademark of Oracle Corporation and/or its
affiliates. Other names may
be trademarks of their respective
owners.
Type 'help;' or '\h' for
help. Type '\c' to clear the current input statement.
mysql>
[root@mail ~]# chkconfig
mysqld on
[root@mail ~]# chkconfig
--level 24 mysqld off
[root@mail ~]# chkconfig
--list mysqld
mysqld
0:off
1:off
2:off
3:on
4:off
5:on
6:off
[root@mail lib]# vim
/etc/ld.so.conf
/software/mysql/lib
[root@mail ~]# ldconfig -v
|grep mysql
/software/mysql/lib:
libmysqlclient.so.18 ->
libmysqlclient_r.so.18.0.0
##------------------------------------------------------------------------------
###############config my.cnf
and mysql_log#########################
[root@kvm db]# mkdir /storage/db/innodb_data/ -p
[root@kvm mysql_logs]# mkdir /storage/db/mysql_logs/binary_log
-p
[root@kvm mysql_logs]# mkdir /storage/db/mysql_logs/innodb_log
-p
[root@kvm mysql_logs]# mkdir /storage/db/mysql_logs/query_log
-p
[root@kvm mysql_logs]# mkdir
/storage/db/mysql_logs/slow_query_log -p
[root@kvm mysql_logs]# mkdir /storage/db/mysql_logs/error_log
-p
[root@kvm db]# chown mysql. * -R
[root@kvm db]# ll
总用量 12
drwxr-xr-x 2 mysql mysql 4096 9月
7 12:06 innodb_data
drwxr-xr-x 5 mysql mysql 4096 9月
7 11:32 mysql_data
drwxr-xr-x 7 mysql mysql 4096 9月
7 12:12 mysql_logs
[root@db-grassroots-61-001 ~]# cat /etc/mysql/my.cnf
[client]
#password = [your_password]
port = 7454
socket = /tmp/mysqld.sock
default-character-set=utf8
[mysqld]
port = 7454
socket = /tmp/mysqld.sock
character_set_server=utf8
back_log = 50
log-error=/storage/db/mysql_logs/error_log/server.err
max_connections = 100
max_connect_errors = 10
table_open_cache = 2048
max_allowed_packet = 16M
binlog_cache_size = 1M
max_heap_table_size = 64M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
join_buffer_size = 8M
thread_cache_size = 8
thread_concurrency = 8
query_cache_size = 64M
query_cache_limit = 2M
ft_min_word_len = 4
#default-storage-engine = MYISAM
default-storage-engine = innodb
thread_stack = 192K
transaction_isolation = REPEATABLE-READ
tmp_table_size = 64M
log-bin=/storage/db/mysql_logs/binary_log/db-bin
expire_logs_days=10
binlog_format=mixed
#general_log=1
#general_log_file=/storage/db/mysql_logs/query_log/query.log
slow_query_log=1
long_query_time = 2
slow_query_log_file=/storage/db/mysql_logs/slow_query_log/slow_query.log
server-id = 1
key_buffer_size = 32M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover
innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 300M
innodb_data_file_path =
ibdata1:100M;ibdata2:100M;ibdata3:100M;ibdata4:100M:autoextend
innodb_data_home_dir=/storage/db/innodb_data/
innodb_write_io_threads = 8
innodb_read_io_threads = 8
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 8M
innodb_log_file_size = 256M
innodb_log_files_in_group = 3
innodb_log_group_home_dir=/storage/db/mysql_logs/innodb_log
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
pager=less -SFX
prompt=\\h/\\u:[\\d]>\\_
no-auto-rehash
[myisamchk]
key_buffer_size = 512M
sort_buffer_size = 512M
read_buffer = 8M
write_buffer = 8M
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
open-files-limit = 8192
##################################install
memcached############################
[root@kvm ~]# cat /etc/init.d/memcached
#!/bin/sh
#
# chkconfig: - 85 17
# description: Memcached Server!
#Mon Jan 17 15:54:53 CST 2011
. /etc/rc.d/init.d/functions
. /etc/sysconfig/network
start()
{
echo -n $"Starting memcached: "
/usr/local/memcached/bin/memcached -d -m 50 -l
192.168.1.100 -u memcached -p 10000
echo "This is UP OK!"
}
stop()
{
echo -n $"Shuttingdown memcached: "
killproc memcached
echo "This is Down OK!"
}
stats()
{
echo -n $"Stats memcached: "
echo "stats" | nc 192.168.1.100 10000
}
cleans()
{
echo -n $"cleans memcached: "
echo "flush_all" | nc 192.168.1.100 10000
}
[ -f /usr/local/memcached/bin/memcached ] || exit 0
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
stats)
stats
;;
cleans)
cleans
;;
*)
echo $"Usage: $0
{start|stop|restart|stats|cleans}"
exit 1
esac
exit 0
[root@kvm opt]# tar zxvf
libevent-2.0.13-stable.tar.gz
[root@kvm opt]# cd libevent-2.0.13-stable
[root@kvm libevent-2.0.13-stable]# ./configure
--prefix=/usr/local/libevent
[root@kvm libevent-2.0.13-stable]# make
&& make
install
[root@kvm libevent-2.0.13-stable]# ln -s
/usr/local/libevent/lib/libevent-2.0.so.5 /usr/lib
[root@kvm opt]# groupadd memcached
[root@kvm opt]# useradd -g memcached -s
/sbin/nologin memcached
[root@kvm opt]# tar zxvf
memcached-1.4.7.tar.gz
[root@kvm opt]# cd memcached-1.4.7
[root@kvm memcached-1.4.7]# ./configure
--prefix=/usr/local/memcached --with-
libevent=/usr/local/libevent
[root@kvm memcached-1.4.7]# make
&& make install
[root@kvm ~]# chmod 755 /etc/init.d/memcached
[root@kvm ~]# /etc/init.d/memcached s
Usage: /etc/init.d/memcached
{start|stop|restart|stats|cleans}
[root@kvm ~]# /etc/init.d/memcached start
Starting memcached: This is UP OK!
[root@kvm ~]# ps -ef |grep memcached
502 5620 1 0
13:55 ? 00:00:00 /usr/local/memcached/bin/memcached -d -m
50 -l
192.168.1.100 -u memcached -p 10000
root 5643 5563 0
13:57 pts/0 00:00:00 grep
memcached
[root@kvm ~]# netstat -an |grep 10000
tcp 0 0 192.168.1.100:10000 0.0.0.0:*
LISTEN
udp 0 0 192.168.1.100:10000 0.0.0.0:*
[root@kvm ~]# chkconfig memcached on
[root@kvm ~]# chkconfig --list memcached
memcached 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭