mysql 5.5.23的安装及配置
myql 5.5.23安装:
1. 安装一些需要的库
yum install gcc-c++ gperf ncurses-devel readline-devel libaio-devel bison ncurses-devel
2. mysql 5.5以后用cmake编译了,安装cmake:
wget http://www.cmake.org/files/v2.8/cmake-2.8.8.tar.gz
cd cmake-2.8.8
./configure
make && make install
3.编译mysql:
下载解压后:
cd mysql-5.5.23
cmake -DCMAKE_INSTALL_PREFIX=/data1/app/services/mysql5_5 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DENABLED_LOCAL_INFILE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DMYSQL_TCP_PORT=3306 -DMYSQL_USER=mysql
make && make install
cd /data1/app/services/mysql5_5
scripts/mysql_install_db --user=mysql --datadir=data
cp support-files/mysql.server /etc/init.d/mysql55
chmod 755 /etc/init.d/mysql55
chkconfig --level 345 mysql55 on
启动:
service mysql start
修改密码:
mysql -h 127.0.0.1
GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY 'password' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO root@"127.0.0.1" IDENTIFIED BY 'password' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO root@"localhost" IDENTIFIED BY 'password' WITH GRANT OPTION;
flush privileges;
下面是一个mysql 5.5 的my.cnf文件例子:
[client]
port = 3306
default-character-set = utf8
socket = /data1/app/tmp/mysql.sock
[mysqld]
datadir = /data1/app/services/mysql5_5/data
socket = /data1/app/tmp/mysql.sock
pid-file = /data1/app/tmp/mysql.pid
user = mysql
port = 3306
character-set-server = utf8
collation-server = utf8_general_ci
#default-storage-engine=INNODB
skip-name-resolve
skip-external-locking
key_buffer = 128M
max_allowed_packet = 4M
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 = 256M
tmp_table_size = 128M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 16
lower_case_table_names = 1
back_log = 500
max_connect_errors = 1000
max_connections = 1600
slow_query_log_file = /data1/app/log/mysql/mysql-slow.log
slow_query_log = 1
log-queries-not-using-indexes
long_query_time = 1
wait_timeout = 86400
server-id = 1
log-bin = mysql-bin
expire-logs-days = 7
log-error = mysql-bin.err
binlog_do_db = flowershop
sync-binlog = 0
innodb_buffer_pool_size = 24G
innodb_additional_mem_pool_size = 128M
innodb_file_per_table
innodb_open_files = 65535
innodb_lock_wait_timeout = 10
innodb_rollback_on_timeout = on
innodb_log_file_size = 1G
innodb_log_buffer_size = 256M
innodb_flush_method = O_DIRECT
innodb_flush_log_at_trx_commit = 2
innodb_data_file_path = ibdata1:20M:autoextend
#innodb_file_io_threads = 8
innodb_read_io_threads = 8
innodb_write_io_threads = 8
#innodb_force_recovery = 1
innodb_thread_concurrency = 30
innodb_flush_log_at_trx_commit = 2
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 80
innodb_file_format = Barracuda
innodb_file_format_max = Barracuda
innodb_io_capacity = 400
innodb_use_native_aio = 1
#binlog_format = mixed
#transaction-isolation = READ-UNCOMMITTED
[mysqld_safe]
log-error=/data1/app/log/mysql/mysql.log
类别: Database 查看评论