Complete MySQL installation and master-slave dual-machine configuration
Example HOST: 192.168.0.1 example slave: 192.168.0.2
################### Complete mysql installation ################## #
Groupadd mysql
Useradd-g mysql
Mv/root/mysql-5.0.51b.tar.gz/usr/local/src
Tar-zxvf mysql-5.0.51b.tar.gz
Cd mysql-5.0.51b
. /Configure-with-charset = latin1-with-extra-charsets = all-enable-starter er-with-mysqld-ldflags =-all-static-with-mysqld-user = mysql- prefix =/usr/local/mysql-5.0.51b-localstatedir =/data/mysql5051_db
Make
Make install
Ln-s/usr/local/mysql-5.0.51b/usr/local/mysql
Mkdir-p/data/mysql5051_db/dbdata
Mkdir-p/data/mysql5051_db/innodb
Mkdir-p/data/mysql5051_db/binlog
Chown-R mysql: mysql/data/mysql5051_db
Chmod-R 775/data/mysql5051_db
Cd/usr/local/src/mysql-5.0.51b
Vim./scripts/ldata =/data/mysql5051_db/dbdata in mysql_install_db
Cp./support-files/my-small.cnf/etc/my. cnf
/Usr/local/mysql-5.0.51b/bin/mysql_install_db-basedir =/usr/local/mysql-5.0.51b-ldata =/data/mysql5051_db/dbdata-user = mysql
Vim/etc/my. cnf
Bind-address = 192.168.0.8
Datadir =/data/mysql5051_db/dbdata/
Pid-file =/data/mysql5051_db/my. pid
Log-slow-queries =/data/mysql5051_db/dbdata/slowquery. SQL
Log-bin =/data/mysql5051_db/binlog/sortrepl. log
################ Innodb ####################
# Uncomment the following if you are using InnoDB tables
Innodb_data_home_dir =/data/mysql5051_db/innodb/
Innodb_data_file_path = ibdata1: 1000 M; ibdata2: 1000 M: autoextend: max: 800 M
Innodb_log_group_home_dir =/data/mysql5051_db/innodb/
Innodb_log_arch_dir =/data/mysql5051_db/innodb/
# You can set .. _ buffer_pool_size up to 50-80%
# Of RAM but beware of setting memory usage too high
Innodb_buffer_pool_size = 600 M
Innodb_additional_mem_pool_size = 20 M
# Set .. _ log_file_size to 25% of buffer pool size
Innodb_log_files_in_group = 4
Innodb_log_file_size = 400 M
Innodb_log_buffer_size = 160 M
Innodb_flush_log_at_trx_commit = 0
Innodb_thread_concurrency = 8
# Innodb_flush_method = O_DSYNC
Innodb_lock_wait_timeout = 50
################ Innodb ####################
# Start the service
#/Usr/local/mysql/bin/mysqld_safe-umysql &
#/Usr/local/mysql-5.0.51b/bin/mysql
# Close the service
#/Usr/local/mysql/bin/mysqladmin shutdown
################### Complete mysql installation ################# ##
For more details, please continue to read the highlights on the next page:
Recommended reading:
Load Nginx in Ubuntu for high-performance WEB Server 5 --- MySQL master/Master Synchronization
Production Environment MySQL master/Master synchronization primary key conflict handling
MySQL Master/Slave failure error Got fatal error 1236
MySQL master-slave replication, implemented on a single server