mysql多实例部署之开机自启

  1. 找到控制服务的文件
[root@localhost ~]# find /usr/local/ -name  mysqld_multi*
/usr/local/mysql-5.7.34-linux-glibc2.12-x86_64/bin/mysqld_multi
/usr/local/mysql-5.7.34-linux-glibc2.12-x86_64/share/mysqld_multi.log
/usr/local/mysql-5.7.34-linux-glibc2.12-x86_64/man/man1/mysqld_multi.1
/usr/local/mysql-5.7.34-linux-glibc2.12-x86_64/support-files/mysqld_multi.server # 这个就是
  1. cp到etc/init.d/
[root@localhost ~]# cp /usr/local/mysql-5.7.34-linux-glibc2.12-x86_64/support-files/mysqld_multi.server /etc/init.d/mysqld_multi
  1. 加入环境变量
export PATH=/usr/local/mysql/bin:$PATH
#加到cp的mysqld_multi
  1. 看看能否正常启动
[root@localhost ~]# service mysqld_multi start 
[root@localhost ~]# ss -antl
State      Recv-Q Send-Q              Local Address:Port                             Peer Address:Port              
LISTEN     0      128                             *:111                                         *:*                  
LISTEN     0      5                   192.168.122.1:53                                          *:*                  
LISTEN     0      128                             *:22                                          *:*                  
LISTEN     0      128                     127.0.0.1:631                                         *:*                  
LISTEN     0      100                     127.0.0.1:25                                          *:*                  
LISTEN     0      80                             :::3306                                       :::*                  
LISTEN     0      80                             :::3307                                       :::*                  
LISTEN     0      80                             :::3308                                       :::*                  
LISTEN     0      128                            :::111                                        :::*                  
LISTEN     0      128                            :::22                                         :::*                  
LISTEN     0      128                           ::1:631                                        :::*                  
LISTEN     0      100                           ::1:25                                         :::*                  
[root@localhost ~]# pkill mysqld
[root@localhost ~]# ss -antl
State      Recv-Q Send-Q              Local Address:Port                             Peer Address:Port              
LISTEN     0      128                             *:111                                         *:*                  
LISTEN     0      5                   192.168.122.1:53                                          *:*                  
LISTEN     0      128                             *:22                                          *:*                  
LISTEN     0      128                     127.0.0.1:631                                         *:*                  
LISTEN     0      100                     127.0.0.1:25                                          *:*                  
LISTEN     0      128                            :::111                                        :::*                  
LISTEN     0      128                            :::22                                         :::*                  
LISTEN     0      128                           ::1:631                                        :::*                  
LISTEN     0      100                           ::1:25                                         :::*                  

加入chkconfig

[root@localhost ~]# chkconfig --add mysqld_multi
[root@localhost ~]# chkconfig --list
注:该输出结果只显示 SysV 服务,并不包含
原生 systemd 服务。SysV 配置数据
可能被原生 systemd 配置覆盖。 

      要列出 systemd 服务,请执行 'systemctl list-unit-files'。
      查看在具体 target 启用的服务请执行
      'systemctl list-dependencies [target]'。

mysqld_multi    0:1:2:3:4:5:6:关
netconsole      0:1:2:3:4:5:6:关
network         0:1:2:3:4:5:6:

重启尝试

[root@localhost ~]# reboot

连接断开
连接成功
Last login: Sun Aug 29 03:01:45 2021 from 192.168.216.1
[root@localhost ~]# ss -antl
State      Recv-Q Send-Q              Local Address:Port                             Peer Address:Port              
LISTEN     0      128                             *:111                                         *:*                  
LISTEN     0      5                   192.168.122.1:53                                          *:*                  
LISTEN     0      128                             *:22                                          *:*                  
LISTEN     0      128                     127.0.0.1:631                                         *:*                  
LISTEN     0      100                     127.0.0.1:25                                          *:*                  
LISTEN     0      80                             :::3306                                       :::*                  
LISTEN     0      80                             :::3307                                       :::*                  
LISTEN     0      80                             :::3308                                       :::*                  
LISTEN     0      128                            :::111                                        :::*                  
LISTEN     0      128                            :::22                                         :::*                  
LISTEN     0      128                           ::1:631                                        :::*                  
LISTEN     0      100                           ::1:25                                         :::*      
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值