相关栏目: IT资讯 当前位置:主页 > IT资讯 >

mysql操作命令master-to-master

发布时间:2018-12-04 作者:凯发K 分类:IT资讯

mysql操作命令发发发master-to-master   1.select语句中把两个字符串字段合并成一个字段: select concat(a, b) as c from tables   2.按日期分组查询 select DATE_FORMAT( created_at, '%Y-%m-%d %H' )  as t from tables group by t   3.mysql创建用户/添加远程/修改用户密码 先进入mysql命令:mysql -uroot -proot ->create user [email protected]'192.168.39.%' IDENTIFIED BY 'password'; 配置远程 ->GRANT REPLICATION SLAVE,REPLICATION CLIENT ON *.* TO [email protected]'192.168.39.%' IDENTIFIED BY 'password'; 修改密码 ->update mysql.user set password=PASSWORD('AAA') where user='username'; ->flush privileges;   4.master-to-master 先配置远程: GRANT REPLICATION SLAVE,REPLICATION CLIENT ON *.* TO [email protected]'192.168.39.%' IDENTIFIED BY 'password'; 建立master: ->slave stop; ->change master to master_host='192.168.0.2', ->master_user='backup', ->master_password='back', ->master_log_file='mysql-bin.000001', ->master_log_pos=106;   ->slave start; ->show slave status\G   4.查看server_id,注意master-to-master时,两个服务器的server_id不能一样,需要修改。 ->show variables like 'server_id'; 修改server_id ->set global server_id=10;   5.查看auto_increment_increment与auto_increment_offset值: ->SHOW VARIABLES LIKE 'auto_inc%';   6.两个服务器master-to-master,必须设置auto_increment_offset值为不同,如下: 第一台: auto_increment_increment =2  #为开始值 auto_increment_offset = 1 第二台: auto_increment_increment =2  #为开始值 auto_increment_offset = 2   7.mysql远程链接权限有以下14个: select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file  

http://www.bkjia.com/Mysql/487746.htmlwww.bkjia.comtruehttp://www.bkjia.com/Mysql/487746.htmlTechArticlemysql操作命令master-to-master 1.select语句中把两个字符串字段合并成一个字段: select concat(a, b) as c from tables 2.按日期分组查询 select DATE_FORMAT(...

本文源自: 凯发国际

上一篇:sql union 效率与union all区别 下一篇:没有了

Copyright © 2005-2016 http://www.owlpma.com 凯发国际_凯发国际开户礼金_凯发注册送_新浪娱乐版权所有 凯发国际_凯发国际开户礼金_凯发注册送_新浪娱乐