--------------------------------------------------------------------------------------------------
//参考配置
./configure –prefix=/usr/local/mysql –localstatedir=/usr/local/mysql/var/ –with-server-suffix=-enterprise-gpl –without-debug –with-big-tables –with-extra-charsets=latin1,gb2312,big5,utf8,GBK –with-extra-charsets=all –with-pthread –enable-static –enable-thread-safe-client –with-client-ldflags=-all-static –with-mysqld-ldflags=-all-static –enable-assembler –with-plugins=innobase
./configure --prefix=/usr/local/mysql --enable-thread-safe-client --enable-assembler --with-charset=utf8 --enable-thread-safe-client --with-extra-charsets=all --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=innobase
--------------------------------------------------------------------------------------------
(一)安装mysql数据库
1.解压 mysql-5.1.66.tar.gz
2. 进入解压的文件夹
============================ configure ==========================
./configure \
--prefix=/home/xxxx/user/mysql5 \
--with-charset=gbk \
--with-extra-charsets=gbk,utf8,ascii,big5,latin1,binary \
--with-plugins=innobase \
--with-unix-socket-path=/home/xxxx/user/mysql5/tmp/mysql.sock
====================================================================
3. make
4. make install
5. cd mysql
(1)建立etc log tmp var 空文件夹
(2)在/etc下的建my.cnf 文件(注意:路径为当前环境的路径)
============
见下面
============
6. 进入/bin目录,生成mysql数据库和表文件
./mysql_install_db --user=root
7.启动(或关闭mysql)
./mysqld_safe & (./mysqladmin -uroot -p shutdown)
8.进入/bin目录,添加系统用户
./mysqladmin -u root password 123
9.使用mysql 或 修改系统(或普通)用户密码
./mysql -uroot -p123
// Use mysql
// Update user set password= PASSWORD('123') where user=’root’ ;
10.添加用户并授权
grant all privileges on 数据库.表名 to ‘用户’@’IP地址’ identified by ‘密码’;
grant all privileges on *.* to 'root'@'10.237.1.174' identified by '123';
========================= my.cnf ===========================================
[client]
port = 3366
socket = /home/xxxx/user/mysql5/tmp/mysql.sock
[mysqld]
port = 3366
socket = /home/xxxx/user/mysql5/tmp/mysql.sock
pid-file = /home/xxxx/user/mysql5/var/mysql.pid
basedir = /home/xxxx/user/mysql5/
datadir = /home/xxxx/user/mysql5/var/
# tmp dir settings
tmpdir = /home/xxxx/user/mysql5/tmp/
slave-load-tmpdir = /home/xxxx/user/mysql5/tmp/
# skip options
skip-name-resolve
skip-symbolic-links
skip-external-locking
skip-slave-start
# res settings
back_log = 50
max_connections = 1000
max_connect_errors = 10000
connect-timeout = 5
wait-timeout = 28800
interactive-timeout = 28800
slave-net-timeout = 600
net_read_timeout = 30
net_write_timeout = 60
net_retry_count = 10
net_buffer_length = 16384
max_allowed_packet = 64M
#
table_cache = 512
thread_stack = 192K
thread_cache_size = 20
thread_concurrency = 8
# qcache settings
query_cache_size = 0
query_cache_limit = 0
query_cache_min_res_unit = 0
# default settings
default-time-zone = system
character-set-server = gbk
default-storage-engine = MyISAM
# tmp & heap
tmp_table_size = 512M
max_heap_table_size = 512M
log-bin = mysql-bin
log-bin-index = mysql-bin.index
relay-log = relay-log
relay_log_index = relay-log.index
# warning & error log
log-warnings = 1
log-error = /home/xxxx/user/mysql5/log/mysql.err
# slow query log
long-query-time = 1
log-slow-queries = /home/xxxx/user/mysql5/log/slow.log
#log-queries-not-using-indexes
log = /home/xxxx/user/mysql5/log/mysql.log
max_binlog_size = 1G
max_relay_log_size = 1G
# if use auto-ex, set to 0
relay-log-purge = 1
# max binlog keeps days
expire_logs_days = 0
binlog_cache_size = 1M
# replication
replicate-wild-ignore-table = mysql.%
replicate-wild-ignore-table = test.%
# slave_skip_errors=all
key_buffer_size = 256M
sort_buffer_size = 2M
read_buffer_size = 2M
join_buffer_size = 8M
read_rnd_buffer_size = 8M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 64M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover
transaction_isolation = REPEATABLE-READ
innodb_file_per_table
#innodb_status_file = 1
#innodb_open_files = 2048
innodb_additional_mem_pool_size = 100M
innodb_buffer_pool_size = 512M
innodb_data_home_dir = /home/xxxx/user/mysql5/var/
innodb_data_file_path = ibdata1:1G:autoextend
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 = 1900M
innodb_log_files_in_group = 2
innodb_log_group_home_dir = /home/xxxx/user/mysql5/var/
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 100
#innodb_flush_method = O_DSYNC
[mysqldump]
quick
max_allowed_packet = 64M
[mysql]
disable-auto-rehash
default-character-set = gbk
connect-timeout = 3
[isamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
[myisamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
========================= my.cnf ===========================================