要用到cmake,如果没有安装,则先yum -y install cmake yum install build-essential ncurses-libs ncurses-devel cmake libbz2-dev python-dev
MysqL安装: /usr/sbin/groupadd
MysqL /usr/sbin/useradd -g
MysqL MysqL cd /tmp/
MysqL-5.5.30 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/
MysqL5530 \ -D
MysqL_DATADIR=/data/
MysqL/4095/data \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -D
MysqL_UNIX_ADDR=/tmp/
MysqL4095.sock \ -D
MysqL_TCP_PORT=3306 \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_EXTRA_CHARSETS=all \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_SSL=yes make make install my.cnf [client] character-set-server = utf8 port = 4095 socket = /data/
MysqL/4095/
MysqL4095.sock 3306.sock [
MysqLd] server-id = 1 character-set-server = utf8 user =
MysqL port = 4095 socket = /data/
MysqL/4095/
MysqL4095.sock basedir = /usr/local/
MysqL5530 datadir = /data/
MysqL/4095/data log-error = /data/
MysqL/4095/
MysqL_error.log pid-file = /data/
MysqL/4095/
MysqL.pid log-bin = /data/
MysqL/4095/binlog/binlog binlog_cache_size = 4M binlog_format = MIXED max_binlog_cache_size = 8M max_binlog_size = 1G relay-log-index = /data/
MysqL/4095/relaylog/relaylog.index #relay-log-info-file = /data/
MysqL/4095/relaylog/relaylog relay-log = /data/
MysqL/4095/relaylog/relaylog replicate-ignore-db =
MysqL replicate-ignore-db = test replicate-ignore-db = information_schema slow_query_log=1 long_query_time=2 slow_query_log_file=/data/
MysqL/4095/
MysqL_slow.log #慢
查询日志 open_files_limit = 10240 back_log = 600 max_connections = 5000 max_connect_errors = 6000 table_cache = 614 external-locking = FALSE max_allowed_packet = 32M sort_buffer_size = 1M join_buffer_size = 1M thread_cache_size = 300 #thread_concurrency = 8 query_cache_size = 512M query_cache_limit = 2M query_cache_min_res_unit = 2k default-storage-engine = MyISAM thread_stack = 192K transaction_isolation = READ-COMMITTED tmp_table_size = 246M max_heap_table_size = 246M long_query_time = 3 log-slave-updates expire_logs_days = 30 key_buffer_size = 256M read_buffer_size = 1M read_rnd_buffer_size = 16M bulk_insert_buffer_size = 64M myisam_sort_buffer_size = 128M myisam_max_sort_file_size = 10G myisam_repair_threads = 1 myisam_recover interactive_timeout = 120 wait_timeout = 120 skip-name-resolve #master-connect-retry = 10 slave-skip-errors = 1032,1062,126,1114,1146,1048,1396 #master-host = 192.168.1.2 #master-user = username #master-password = password #master-port = 3306 innodb_additional_mem_pool_size = 16M innodb_buffer_pool_size = 512M innodb_data_file_path = ibdata1:256M:autoextend innodb_file_io_threads = 4 innodb_thread_concurrency = 8 innodb_flush_log_at_trx_commit = 2 innodb_log_buffer_size = 16M innodb_log_file_size = 128M innodb_log_files_in_group = 3 innodb_max_dirty_pages_pct = 90 innodb_lock_wait_timeout = 120 innodb_file_per_table = 0 [
MysqLdump] quick max_allowed_packet = 32M 初始化
数据库 bash scripts/
MysqL_install_db --user=
MysqL --basedir=/usr/local/
MysqL5530 --datadir=/data/
MysqL/4095/data 启动/usr/local/
MysqL5530/bin/
MysqLd --defaults-file=/data/
MysqL/4095/my.cnf & 登陆: /usr/local/
MysqL5530/bin/
MysqL -uroot -p -h127.0.0.1 -P4095 -S '/data/
MysqL/4095/
MysqL4095.sock'
修改root密码
MysqL>use
MysqL ;
MysqL> update user set password=PASSWORD("123456") where user='root';
MysqL> FLUSH PRIVILEGES; 下面是一些主要的配置: log_error=/data/
MysqL/4095/
MysqL_error.log show_query_log=1 long_query_time=2 slow_query_log_file=/data/
MysqL/4095/
MysqL_slow.log #慢
查询日志 #binlog记录
文件 log-bin=/data/
MysqL/4095/binlog/binlog binlog-ignore-db=
MysqL binlog-ignore-db=test binlog-ignore-db = information_schema #从库的同步日志信息 relay-log-index=/data/
MysqL/4095/relaylog/relaylog.index relay-log=/data/
MysqL/4095/relaylog/relaylog 主从同步配置 1.先安装
MysqL,分别启动主库和从库 像上面的配置,把
MysqL的数据及日志等信息都放在/data/
MysqL/4095下面 启动从库的话,直接cp -r 4095 4096 cd 4096
修改my.cnf 把server-id设置成server-id = 2 把4095全部
修改成4096 %s/4095/4096/g 把所有4095
修改成4096 即可启动从加4096 2.在主库从库上创建同步
用户 CREATE USER repl; GRANT REPLICATION SLAVE ON *.* TO repl IDENTIFIED BY '123456'; 3.读取主库的binlog日志
文件跟位置 show master status; 4.在从库上配置同步 stop slave; change master to master_host='192.168.1.141',master_port=3306,master_user='repl',master_password='123456',master_log_file='binlog.000063',master_log_pos=107; start slave;