linux下mysql 有双机_MySQL完整安装和主从双机配置

MySQL完整安装和主从双机配置

示例主机:192.168.0.1  示例备机:192.168.0.2

################### mysql 完整安装 ###################

groupadd  mysql

useradd -g mysql 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-assembler –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/mysql_install_db中的ldata=/data/mysql5051_db/dbdata

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:1000M;ibdata2:1000M:autoextend:max:800M

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 = 600M

innodb_additional_mem_pool_size = 20M

# Set .._log_file_size to 25 % of buffer pool size

innodb_log_files_in_group = 4

innodb_log_file_size = 400M

innodb_log_buffer_size = 160M

innodb_flush_log_at_trx_commit = 0

innodb_thread_concurrency = 8

#innodb_flush_method = O_DSYNC

innodb_lock_wait_timeout = 50

################innodb####################

#启动服务

# /usr/local/mysql/bin/mysqld_safe -umysql &

# /usr/local/mysql-5.0.51b/bin/mysql

#关闭服务

# /usr/local/mysql/bin/mysqladmin shutdown

################### mysql 完整安装完成 ###################

推荐阅读:

0b1331709591d260c1c78e86d0c51c18.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值