[size=x-large][b]编译安装[/b][/size]
添加mysql用户用户组:
编译mysql:
安装:
改变目录权限:
初始化权限表等(root执行)
配置文件
安装目录下my.cnf,内容
启动脚本
copy src/support-files/mysql.server 到 /etc/init.d/mysql
添加mysql用户用户组:
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
编译mysql:
#!/bin/sh
CFLAGS="-O3 -mpentiumpro -mstack-align-double"
CXX=gcc
CXXFLAGS="-O3 -mpentiumpro -mstack-align-double -felide-constructors -fno-exceptions -fno-rtti"
./configure --prefix=/home/admin/install/mysql \
--with-charset=utf8 \
--with-collation=utf8_general_ci \
--enable-thread-safe-client \
--with-extra-charsets=gbk,latin1 \
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \
--enable-assembler \
--with-unix-socket-path=/home/admin/install/mysql/var/mysql.sock \
安装:
make& make install改变目录权限:
sudo chown -R mysql:mysql /home/admin/install/mysql/初始化权限表等(root执行)
/home/admin/install/mysql/bin/mysql_install_db --user=mysql --basedir=/home/admin/install/mysql --datadir=/home/admin/install/mysql/data 配置文件
安装目录下my.cnf,内容
[client]
port = 3306
socket = /home/admin/install/mysql/var/mysql.sock
[mysqld]
port = 3306
socket = /home/admin/install/mysql/var/mysql.sock
datadir = /home/admin/install/mysql/data
default-character-set=utf8
default-collation=utf8_unicode_ci
back_log = 50
max_connections = 2000
max_connect_errors = 10
table_cache = 2048
max_allowed_packet = 16M
binlog_cache_size = 1M
max_heap_table_size = 64M
sort_buffer_size = 8M
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_table_type = InnoDB
thread_stack = 192K
transaction_isolation = REPEATABLE-READ
tmp_table_size = 64M
log-bin=mysql-bin
long_query_time = 2
log_long_format
innodb_file_per_table
innodb_buffer_pool_size = 1G
innodb_additional_mem_pool_size = 16M
innodb_data_file_path = ibdata1:10M:autoextend:max:2000M
innodb_file_io_threads = 4
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 8M
innodb_log_file_size = 64M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
[mysqldump]
# Do not buffer the whole result set in memory before writing it to
# file. Required for dumping very large tables
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Only allow UPDATEs and DELETEs that use keys.
#safe-updates
[isamchk]
key_buffer = 512M
sort_buffer_size = 512M
read_buffer = 8M
write_buffer = 8M
[myisamchk]
key_buffer = 512M
sort_buffer_size = 512M
read_buffer = 8M
write_buffer = 8M
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
# Increase the amount of open files allowed per process. Warning: Make
# sure you have set the global system limit high enough! The high value
# is required for a large number of opened tables
open-files-limit = 8192
启动脚本
copy src/support-files/mysql.server 到 /etc/init.d/mysql
/etc/init.d/mysql start启动mysql

被折叠的 条评论
为什么被折叠?



