日期:2014-05-16  浏览次数:20443 次

数据库服务器创建过程
CentOS-5.5-x86_64-bin

使用 yum 程序安装所需开发包(以下为标准的 RPM 包名称)
gcc gcc-c++ gcc-g77 libc-client flex bison autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel vim

定时校正服务器时间
yum install ntp
crontab -e
1 4 * * * ntpdate 210.72.145.44
## 210.72.145.44 为中国国家授时中心服务器地址。

关闭ipv6支持,使用lsmod查看已载入系统的模块,查看是否已经加载ipv6,关闭则在/etc/modprobe.conf加入以下内容:
alias net-pf-10 off
alias ipv6 off

停止打印服务
[root@localhost ~]# /etc/init.d/cups stop
停止 cups: [确定]
[root@localhost ~]# chkconfig cups off

修改命令history记录
# vi /etc/profile
找到 HISTSIZE=1000 改为 HISTSIZE=100

源码安装MYSQL 5.5GA版
下载到/tmp mysql-5.5.8.tar.gz
tar zxvf mysql-5.5.8.tar.gz
CFLAGS="-O3 -g"
CXX=gcc
CXXFLAGS="-O3 -g -felide-constructors -fno-exceptions -fno-rtti"
export CFLAGS CXX CXXFLAGS
MY_dir="/usr/local/mysql"
cmake -DCMAKE_INSTALL_PREFIX="$MY_dir" -DDEFAULT_CHARSET=utf8 -DMYSQL_DATADIR="$MY_dir/"data/ -DCMAKE_INSTALL_PREFIX="$MY_dir" -DSYSCONFDIR="$MY_dir" -DDEFAULT_COLLATION=utf8_general_ci -DENABLE_DEBUG_SYNC=0 -DENABLED_LOCAL_INFILE=1 -DENABLED_PROFILING=1 -DWITH_READLINE=1 .
make
make install
./mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql


my.cnf 内容:
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 256M
max_allowed_packet = 10M
table_open_cache = 512
sort_buffer_size = 2M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 16
#5184 add
#skip-name-resolve
slow-query-log = 20
slow-query-log-file = /usr/local/mysql/data/slow.log
default-storage-engine = MyISAM
character-set-server = utf8
wait_timeout = 28800
interactive_timeout = 28800
#binlog-ignore-db = gk2011
max_heap_table_size=2048M
tmp_table_size = 2048M
max_connections = 4000
#5184 no password
#skip-grant-tables
#5184 add
log-bin=mysql-MasterSlave-bin
# binary logging format - mixed recommended
binlog_format=mixed
server-id = 1
innodb_data_file_path = ibdata1:256M:autoextend
innodb_log_group_home_dir = /usr/local/mysql/data
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 512M
innodb_additional_mem_pool_size = 16M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 128M
innodb_log_buffer_size = 16M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
innodb_thread_concurrency = 8
innodb_max_dirty_pages_pct = 90
innodb_read_io_threads = 4
innodb_write_io_threads = 4
innodb_log_files_in_group = 2
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interacti