MYSQL
环境介绍:主库 192.168.0.205 从库 192.168.0.206
1、主库创建/etc/my.cnf,修改[mysqld]里边的键值打开 master项中
server-id=1
log-bin
2、主库增加用户,用于从库读取主库日志。
grant replication slave,reload,super on *.* to ‘slave’@‘192.168.0.206’ identified by ‘123456’
3、从库连接主库进行测试。
/opt/mysql/bin/mysql -u slave -p -h 192.168.0.205
4、停从库,修改从库/etc/my.cnf,增加选项:
最近要给discuz论坛升级, 数据库是mysql4.0,mysql4.0以前的低版本不支持编码,数据都是Latin1编码的。新版论坛计划采用mysql5.1,gbk编码。
因为mysql版本相差太大,直接复制数据库文件的方法肯定不行,只能采用mysqldump。
步骤:
1. 将mysql4.0中数据导出成sql文件
insert into siteforupdate (`site_id`, `grade`, `snatch_time`) select id, grade, snatch_time FROM sites
replace into siteforupdate (`site_id`, `grade`, `snatch_time`) select id, grade, snatch_time FROM sites
replace into siteforupdate (`site_id`, `grade`, `snatch_time`) select id, grade, snatch_time FROM sites




