mysql5.5.20原始碼安裝

zhouwf0726發表於2019-04-03

rpm -qa|grep  bison
rpm -qa|grep ncurses-devel
yum install bison
yum install ncurses-devel.x86_64

http://www.cmake.org/cmake/resources/software.html
下載cmake-2.8.7.tar.gz
從mysql.com
下載Source Code package : mysql-5.5.20.tar.gz

安裝cmake
# tar zxvf cmake-2.8.7.tar.gz
# cd cmake-2.8.7
# ./bootstrap
# gmake
# gamke install

安裝mysql
tar zxvf mysql-5.5.20.tar.gz
cd mysql-5.5.20

cmake -DCMAKE_INSTALL_PREFIX=/data/mysql \
-DMYSQL_UNIX_ADDR=/data/mysql/data/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=gbk \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_DATADIR=/data/mysql/data \
-DSYSCONFDIR=/data/mysql \
-DMYSQL_TCP_PORT=3306

# make
# make install

# groupadd mysql
# useradd -r -g mysql mysql
# chown -R mysql:mysql /home/mysqldata/

cp /mysqlfile/mysql-5.5.20/support-files/my-large.cnf /data/mysql/my.cnf
cp /mysqlfile/mysql-5.5.20/support-files/mysql.server /etc/init.d/mysqld
chown mysql:mysql /data/mysql/my.cnf
chown mysql:mysql /etc/init.d/mysqld
chmod 744 /etc/init.d/mysqld

chmod +x scripts/mysql_install_db

scripts/mysql_install_db \
--defaults-file=/data/mysql/my.cnf \
--basedir=/data/mysql/ \
--datadir=/data/mysql/data/ \
--user=mysql \
--skip-name-resolve

#增加PATH設定
PATH=$PATH:/data/mysql/bin
# . ~/.bash_profile

# chkconfig --add mysqld
###### chkconfig --level 345 mysqld on

# /etc/init.d/mysqld start OR mysqld_safe & OR service mysqld start
###### mysqld_multi

#修改密碼
# mysqladmin -uroot password "xxxxxx"

引數配置:
[mysqld]
server_id=1
federated

datadir=/data/mysql/data
tmpdir=/data/mysql/tmp

skip-external-locking
key_buffer_size = 256M
myisam_sort_buffer_size = 64M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 24

back_log = 1024
max_connections = 1200
table_definition_cache=120000 
table_open_cache =120000    
max_connect_errors = 300

max_allowed_packet = 24M
read_rnd_buffer_size = 4M
read_buffer_size = 4M
join_buffer_size = 4M
sort_buffer_size = 2M
query_cache_limit = 2M

query_cache_size = 1024M
query_cache_min_res_unit=2k
thread_cache_size = 1200
thread_stack = 128K
tmp_table_size = 256M
max_tmp_tables = 256
bulk_insert_buffer_size = 4M
binlog_cache_size = 2M
max_binlog_size = 128M
max_binlog_cache_size= 512M

# log
log-error=/data/mysql/log/log
log-bin=/data/mysql/log/mysql-bin

slow-query-log
slow-query-log-file=/data/mysql/log/slow.log
long_query_time=1
log-queries-not-using-indexes

# innodb
innodb_buffer_pool_size = 20480M
innodb_data_home_dir = /data/mysql/data
innodb_data_file_path = ibdata1:10M:autoextend
innodb_file_per_table= 1
innodb_log_group_home_dir = /data/mysql/log
innodb_log_files_in_group=3
innodb_log_file_size = 512M
innodb_log_buffer_size = 16M
#innodb_file_io_threads = 4
innodb_thread_concurrency = 24
innodb_lock_wait_timeout = 100
innodb_flush_method = 'O_DIRECT'
innodb_max_dirty_pages_pct = 75
# innodb_flush_log_at_trx_commit=2

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/756652/viewspace-715414/,如需轉載,請註明出處,否則將追究法律責任。

相關文章