b. linux 终端:
service mysqld start --启动 service mysqld stop --暂停 service mysqld restart --重启
3. Window下Mysql服务的注册及卸载
注册mysql服务: mysqld install mysql --defaults-file="C:\Program Files\mysql-5.7.12\my.cnf"
卸载mysql服务: mysqld remove mysql
1主1从服务器搭建
环境介绍:1台win10下的mysql5.6 x服务器 1台CentOS release 6.3 (Final)下的Mysql 5.5.37 x86服务器
mysql5.5.37 作为master 5.6作为Slave
操作:
1>. 配置master的my.cnf
[mysqld] server_id =1 #(不指定的话默认是1) log-bin=master-bin
2>. 配置slave的my.cnf
[mysqld] server-id=2relay_log=slave-relay-binrelay_log_index=slave-relay-bin.index
3>. 分别重启master和slave服务
4>. 在master主机上面创建 REPLICATION SLAVE用户
create user repl_user; GRANTREPLICATION SLAVE ON *.* TO repl_user IDENTIFIED BY 'xyzzy';
5>. 在slave主机上执行
CHANGE MASTER TO MASTER_HOST='121..42.1', MASTER_PORT=3306, MASTER_USER='repl_user', MASTER_PASSWORD='xyzzy';
6>. 在slave主机上执行 START SLAVE
7>. 在slave主机上执行SHOW SLAVE STATUS显示
表示成功。