systemctl与mysql多实例_mysql mariadb 多版本多实例 开机启动
———-mysql多實例開機啟動及加入服務———————–
將腳本cp到init.d目錄
cd /usr/mysqlsoft5.6.38_3346/support-files/
[root@mysql02 support-files]# cp mysql.server /etc/init.d/mysqld3346
[root@mysql02 support-files]# systemctl status mysqld3346
Unit mysqld3346.service could not be found.
[root@mysql02 support-files]# systemctl enable mysqld3346??? —-開機啟動
mysqld3346.service is not a native service, redirecting to /sbin/chkconfig.?? —–有報錯,開機啟動加入失敗
Executing /sbin/chkconfig mysqld3346 on
[root@mysql02 support-files]# systemctl status mysqld3346
● mysqld3346.service – LSB: start and stop MySQL
Loaded: loaded (/etc/rc.d/init.d/mysqld3346; bad; vendor preset: disabled)
Active: inactive (dead)
Docs: man:systemd-sysv-generator(8)
[root@mysql02 support-files]#
[root@mysql02 support-files]# systemctl start mysqld3346
[root@mysql02 support-files]# systemctl status mysqld3346
● mysqld3346.service – LSB: start and stop MySQL
Loaded: loaded (/etc/rc.d/init.d/mysqld3346; bad; vendor preset: disabled)
Active: active (running) since Mon 2017-10-30 03:25:57 EDT; 10s ago
Docs: man:systemd-sysv-generator(8)
Process: 10651 ExecStart=/etc/rc.d/init.d/mysqld3346 start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/mysqld3346.service
├─10659 /bin/sh /usr/mysqlsoft5.6.38_3346/bin/mysqld_safe –datadir=/usr/mysqldata/3346 –pid-file=/…
└─11368 /usr/mysqlsoft5.6.38_3346/bin/mysqld –basedir=/usr/mysqlsoft5.6.38_3346 –datadir=/usr/mysqldate5…
Oct 30 03:25:54 mysql02 systemd[1]: Starting LSB: start and stop MySQL…
Oct 30 03:25:57 mysql02 mysqld3346[10651]: Starting MySQL.. SUCCESS!
Oct 30 03:25:57 mysql02 systemd[1]: Started LSB: start and stop MySQL.
[root@mysql02 support-files]#
查看是否開啟開機啟動
[root@mysql02 support-files]# systemctl is-enabled mysqld3346???? —-一種方式
mysqld3346.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig mysqld3346 –level=5
enabled
[root@mysql02 support-files]# chkconfig –list mysqld3346 —兩種方式
mysqld3346???????? 0:off??? 1:off??? 2:on??? 3:on??? 4:on??? 5:on??? 6:off
—————mariadb多實例開機啟動—————
現在增加 多實例開機啟動腳本
vim /etc/rc.d/init.d/mumysql
#!/bin/bash
#add for chkconfig
#chkconfig: 2345 70 30
#description: mysql autostart
#processname: mumysql
/usr/bin/mysqld_multi –defaults-extra-file=/etc/mysql/cfg3325.cnf –log=/var/log/mysql/mysql_3325.log start
#end
說明:
2345是指腳本的運行級別,即在2345這4種模式下都可以運行,234都是文本界面,5就是圖形界面X
70是指腳本將來的啟動順序號,如果別的程序的啟動順序號比70小(比如44、45),則腳本需要等這些程序都啟動以后才啟動。
30是指系統關閉時,腳本的停止順序號。
chmod +x /etc/rc.d/init.d/mumysql
systemctl enable mumysql
[root@shtsmysql02 support-files]# systemctl is-enabled mumysql
mumysql.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig mumysql –level=5
enabled
[root@shjhmysql01 init.d]# chkconfig –add mumysql?? 在系統里增加開記機啟動
[root@shjhmysql01 init.d]# chkconfig –list?????????? 查看開機啟動列表。
mumysql??????????? 0:off??? 1:off??? 2:on??? 3:on??? 4:on??? 5:on??? 6:off
netconsole???????? 0:off??? 1:off??? 2:off??? 3:off??? 4:off??? 5:off??? 6:off
network??????????? 0:off??? 1:off??? 2:on??? 3:on??? 4:on??? 5:on??? 6:off
—————————————————–
總結
以上是生活随笔為你收集整理的systemctl与mysql多实例_mysql mariadb 多版本多实例 开机启动的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 帮问和田为什么要割包 皮?
- 下一篇: 家常拉面的做法?