============卸载mysql,参考资料:http://www.cnblogs.com/kerrycode/p/4364465.html
1、查看mysql 安装相关情况
rpm -qa | grep -i mysql
2、查看mysql 运行状态:
njhadoopslave2:~ # service mysql status
MySQL running (17640) done
njhadoopslave2:~ #
2、停止mysql
3、卸载rpm
rpm -ev MySQL-devel-5.6.23-1.linux_glibc2.5
purge binary logs to 'mysql-bin.000117';
================安装mysql,参考资料:http://www.th7.cn/system/lin/201412/79139.shtml
【注意】/usr/bin/mysql_install_db #需要使用mysql 用户执行
================配置mysql
一:【注意】/var/lib/mysql/mysql.sock 只能用默认路径的文件。采用其他的好像不行。如果有专家可以咨询下,具体原因。
# basedir = .....
datadir =/mysqlData
port = 3306
server_id = 1
#socket = /mysqlData/mysql.sock
socket = /var/lib/mysql/mysql.sock
二:启动mysql: service mysql start
三:配置mysql root:
set password=password('root');
Grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
================mysql Master/Slave配置:参考http://blog.csdn.net/mr__fang/article/details/8692523
一:【主库配置参考】
修改my.cnf,添加配置如下:
log_bin = /mysqlData/masterLog/mysql-wcb-bin.log
expire_logs_days = 10
binlog-do-db = test # 要给从库同步的库
二:修改后,启动数据库,查看状态并修改从库同步用户名和密码:
查看状态:SHOW MASTER STATUS;
添加从库同步权限:grant replication slave,replication client on *.* to 'slave'@'10.202.16.10' identified by '123456';
三:配置从库:
①修改id:
②stop slave;
③CHANGE MASTER TO MASTER_HOST='10.202.16.9', MASTER_USER='slave', MASTER_PASSWORD='123456', MASTER_PORT=3306,
MASTER_LOG_FILE='mysql-wcb-bin.000002',MASTER_LOG_POS=120,MASTER_CONNECT_RETRY=30;
④start slave;
⑤查看slave状态:SHOW SLAVE STATUS\G;
⑥验证Master/Slave是否可行;
================Mysql 性能调优
后续整理mysql性能调优相关参数调整方案。
1、查看mysql 安装相关情况
rpm -qa | grep -i mysql
2、查看mysql 运行状态:
njhadoopslave2:~ # service mysql status
MySQL running (17640) done
njhadoopslave2:~ #
2、停止mysql
3、卸载rpm
rpm -ev MySQL-devel-5.6.23-1.linux_glibc2.5
purge binary logs to 'mysql-bin.000117';
================安装mysql,参考资料:http://www.th7.cn/system/lin/201412/79139.shtml
【注意】/usr/bin/mysql_install_db #需要使用mysql 用户执行
================配置mysql
一:【注意】/var/lib/mysql/mysql.sock 只能用默认路径的文件。采用其他的好像不行。如果有专家可以咨询下,具体原因。
# basedir = .....
datadir =/mysqlData
port = 3306
server_id = 1
#socket = /mysqlData/mysql.sock
socket = /var/lib/mysql/mysql.sock
二:启动mysql: service mysql start
三:配置mysql root:
set password=password('root');
Grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
================mysql Master/Slave配置:参考http://blog.csdn.net/mr__fang/article/details/8692523
一:【主库配置参考】
修改my.cnf,添加配置如下:
log_bin = /mysqlData/masterLog/mysql-wcb-bin.log
expire_logs_days = 10
binlog-do-db = test # 要给从库同步的库
二:修改后,启动数据库,查看状态并修改从库同步用户名和密码:
查看状态:SHOW MASTER STATUS;
添加从库同步权限:grant replication slave,replication client on *.* to 'slave'@'10.202.16.10' identified by '123456';
三:配置从库:
①修改id:
②stop slave;
③CHANGE MASTER TO MASTER_HOST='10.202.16.9', MASTER_USER='slave', MASTER_PASSWORD='123456', MASTER_PORT=3306,
MASTER_LOG_FILE='mysql-wcb-bin.000002',MASTER_LOG_POS=120,MASTER_CONNECT_RETRY=30;
④start slave;
⑤查看slave状态:SHOW SLAVE STATUS\G;
⑥验证Master/Slave是否可行;
================Mysql 性能调优
后续整理mysql性能调优相关参数调整方案。