MySQL多实例部署

MySQL多实例部署

一. 多实例

1. 概述
  • 在一台服务器上,运行多个数据库服务,这些服务进程通过不同的socket监听不同的服务端口来提供各自的服务
  • 实例,一个实例就是一个数据库管理系统[一个实例默认就是一个端口号]
2. 应用场景
  • 资金比较紧张的公司;

  • 并发访问不是特别大的业务

  • ABC三个项目,在一个数据库运行三个项目,C项目要更新数据库,需要重启数据库,AB项目会受到影响

二. MySQL多实例部署

1. 二进制安装MySQL
1.1 安装mysql
1.解压
[root@128m ~]# cd /usr/local/
[root@128m local]# tar xf mysql-5.7.37-linux-glibc2.12-x86_64.tar.gz
[root@128m local]# ls
bin      libexec
etc      mysql-5.7.37-linux-glibc2.12-x86_64
games    mysql-5.7.37-linux-glibc2.12-x86_64.tar.gz
include  sbin
lib      share
lib64    src

2.创建系统用户
[root@128m local]# useradd -r -M -s /sbin/nologin mysql

3.修改名字
[root@128m local]# ls
bin      libexec
etc      mysql-5.7.37-linux-glibc2.12-x86_64
games    mysql-5.7.37-linux-glibc2.12-x86_64.tar.gz
include  sbin
lib      share
lib64    src
[root@128m local]# mv mysql-5.7.37-linux-glibc2.12-x86_64 mysql

4.修改主和组
[root@128m local]# chown -R mysql.mysql mysql
[root@128m local]# ll
total 650984
drwxr-xr-x. 2 root  root          6 Jun 21  2021 bin
drwxr-xr-x. 2 root  root          6 Jun 21  2021 etc
drwxr-xr-x. 2 root  root          6 Jun 21  2021 games
drwxr-xr-x. 2 root  root          6 Jun 21  2021 include
drwxr-xr-x. 2 root  root          6 Jun 21  2021 lib
drwxr-xr-x. 3 root  root         17 Apr 12 09:07 lib64
drwxr-xr-x. 2 root  root          6 Jun 21  2021 libexec
drwxr-xr-x. 9 mysql mysql       129 Jul  1 21:18 mysql
-rw-r--r--. 1 root  root  666603757 Jul  1 21:14 mysql-5.7.37-linux-glibc2.12-x86_64.tar.gz
drwxr-xr-x. 2 root  root          6 Jun 21  2021 sbin
drwxr-xr-x. 5 root  root         49 Apr 12 09:07 share
drwxr-xr-x. 2 root  root          6 Jun 21  2021 src

5.设置环境变量
[root@128m local]# echo 'export PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysqld.sh
[root@128m local]# source /etc/profile.d/mysqld.sh 

6.man文档
[root@128m mysql]# ls
LICENSE  bin   include  man    support-files
README   docs  lib      share
[root@128m mysql]# vim /etc/man_db.conf 
[root@128m mysql]# cat /etc/man_db.conf |grep /usr/local/mysql/man
MANDATORY_MANPATH                       /usr/local/mysql/man
[root@128m mysql]# 


7.include
[root@128m mysql]# ls
LICENSE  bin   include  man    support-files
README   docs  lib      share
[root@128m mysql]# pwd
/usr/local/mysql
[root@128m mysql]# ln -s /usr/local/mysql/include /usr/include/mysql

8.lib
[root@128m mysql]# ls
LICENSE  bin   include  man    support-files
README   docs  lib      share
[root@128m mysql]# ls /etc/ld.so.c
ld.so.cache   ld.so.conf    ld.so.conf.d/ 
[root@128m mysql]# vim /etc/ld.so.conf.d/mysqld.conf
[root@128m mysql]# cat /etc/ld.so.conf.d/mysqld.conf 
/usr/local/mysql/lib
[root@128m mysql]# ldconfig 
[root@128m mysql]# 
1.2 创建各实例数据存放的目录
[root@128m ~]# mkdir -p /opt/data/{3306,3307,3308}
[root@128m ~]# ls /opt/data/
3306  3307  3308
[root@128m ~]# 
1.3 初始化各实例
3306
[root@128m ~]# mysqld
mysqld         mysqld_multi   mysqldump      
mysqld-debug   mysqld_safe    mysqldumpslow  
[root@128m ~]# mysqld --initialize --user mysql --datadir /opt/data/3306
2022-07-02T03:08:40.743201Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-07-02T03:08:41.069539Z 0 [Warning] InnoDB: New log files created, LSN=45790
2022-07-02T03:08:41.096438Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2022-07-02T03:08:41.103226Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 4654c22c-f9b4-11ec-a0d9-000c2988169d.
2022-07-02T03:08:41.105564Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2022-07-02T03:08:42.418642Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2022-07-02T03:08:42.418682Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2022-07-02T03:08:42.419302Z 0 [Warning] CA certificate ca.pem is self signed.
2022-07-02T03:08:42.768013Z 1 [Note] A temporary password is generated for root@localhost: e7fkf(97qS+2
[root@128m ~]# echo 'e7fkf(97qS+2' > 3306.pass


3307
[root@128m ~]# mysqld --initialize --user mysql --datadir /opt/data/3307
2022-07-02T03:09:55.172425Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-07-02T03:09:55.865009Z 0 [Warning] InnoDB: New log files created, LSN=45790
2022-07-02T03:09:55.980541Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2022-07-02T03:09:56.037432Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 72fecfce-f9b4-11ec-954f-000c2988169d.
2022-07-02T03:09:56.040194Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2022-07-02T03:09:56.702128Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2022-07-02T03:09:56.702168Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2022-07-02T03:09:56.702584Z 0 [Warning] CA certificate ca.pem is self signed.
2022-07-02T03:09:56.774217Z 1 [Note] A temporary password is generated for root@localhost: !GzPI9J9v!mq
[root@128m ~]# echo '!GzPI9J9v!mq' > 3307.pass


3308
[root@128m ~]# mysqld --initialize --user mysql --datadir /opt/data/3308
2022-07-02T05:27:27.426681Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-07-02T05:27:28.893991Z 0 [Warning] InnoDB: New log files created, LSN=45790
2022-07-02T05:27:29.638925Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2022-07-02T05:27:29.806803Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: aaa011bf-f9c7-11ec-8d79-000c2988169d.
2022-07-02T05:27:29.807580Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2022-07-02T05:27:30.481842Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher.
2022-07-02T05:27:30.481889Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher.
2022-07-02T05:27:30.482324Z 0 [Warning] CA certificate ca.pem is self signed.
2022-07-02T05:27:30.796114Z 1 [Note] A temporary password is generated for root@localhost: )#=r:X/kO6eD
[root@128m ~]# echo ')#=r:X/kO6eD' > 3308.pass 

[root@128m ~]# ls
3306.pass  3307.pass  3308.pass  anaconda-ks.cfg
[root@128m ~]#  
1.4 配置/etc/my.cnf
[root@128m ~]# ls
3306.pass  3307.pass  3308.pass  anaconda-ks.cfg
[root@128m ~]# vim /etc/my.cnf
[root@128m ~]# cat /etc/my.cnf 
[mysqld_multi]
mysqld = /usr/local/mysql/bin/mysqld_safe
mysqladmin = /usr/local/mysql/bin/mysqladmin

[mysqld3306]
datadir = /opt/data/3306
port = 3306
socket = /tmp/mysql3306.sock
pid-file = /opt/data/3306/mysql_3306.pid
log-error=/var/log/3306.log

[mysqld3307]
datadir = /opt/data/3307
port = 3307
socket = /tmp/mysql3307.sock
pid-file = /opt/data/3307/mysql_3307.pid
log-error=/var/log/3307.log

[mysqld3308]
datadir = /opt/data/3308
port = 3308
socket = /tmp/mysql3308.sock
pid-file = /opt/data/3308/mysql_3308.pid
log-error=/var/log/3308.log
[root@128m ~]# 
1.5 安装perl和lib库
[root@128m ~]# yum -y install perl ncurses-compat-libs
1.6 启动各实例
[root@128m ~]# ls /usr/local/mysql/bin/mysqld_multi 
/usr/local/mysql/bin/mysqld_multi
[root@128m ~]# file /usr/local/mysql/bin/mysqld_multi 
/usr/local/mysql/bin/mysqld_multi: Perl script text executable
[root@128m ~]# 

[root@128m ~]# mysqld_multi start 3306
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "zh_CN.UTF-8"
    are supported and installed on your system.
[root@128m ~]# mysqld_multi stop 3307
[root@128m ~]# mysqld_multi stop 3308
[root@128m ~]# ss -antl
State  Recv-Q Send-Q Local Address:Port Peer Address:PortProcess 
LISTEN 0      128          0.0.0.0:22        0.0.0.0:*           
LISTEN 0      80                 *:3308            *:*           
LISTEN 0      128             [::]:22           [::]:*           
LISTEN 0      80                 *:3306            *:*           
LISTEN 0      80                 *:3307            *:*  
1.7 设置密码
3306
[root@128m ~]# cat 3306.pass 
e7fkf(97qS+2
[root@128m ~]# mysql -uroot -p'e7fkf(97qS+2' -S /tmp/mysql3306.sock
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.37

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>  set password = password('run123456');
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> 
[root@128m ~]# mysql -uroot -p'run123456' -S /tmp/mysql3306.sock
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.7.37 MySQL Community Server (GPL)

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> quit
Bye
[root@128m ~]# 

  
3307
[root@128m ~]# cat 3307.pass 
!GzPI9J9v!mq
[root@128m ~]# mysql -uroot -p'!GzPI9J9v!mq' -S /tmp/mysql3307.sock
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.37

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> set password = password('run123456');
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> quit
Bye
[root@128m ~]# 
[root@128m ~]# mysql -uroot -p'run123456' -S /tmp/mysql3307.sockmysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.37 MySQL Community Server (GPL)

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> quit
Bye
[root@128m ~]# 

  
3308
[root@128m ~]# mysql -uroot -p')#=r:X/kO6eD' -S /tmp/mysql3308.sock
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.37

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> set password = password('run123456');
Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> 
[root@128m ~]# mysql -uroot -p'run123456' -S /tmp/mysql3308.sockmysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.37 MySQL Community Server (GPL)

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> quit
Bye
[root@128m ~]# 
1.8 指定端口号和主机
[root@128m ~]# mysql -uroot -p'run123456' -h127.0.0.1 -P3306
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.7.37 MySQL Community Server (GPL)

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> quit
Bye
[root@128m ~]# 
1.9 测试是否为一个项目
3306
mysql> create database test;
Query OK, 1 row affected (0.09 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| school             |
| sys                |
| test               |
+--------------------+
6 rows in set (0.00 sec)

mysql> 


3307
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.01 sec)

mysql> 


2. 配置开机自启
2.1 3306
停止服务
[root@128m ~]# ps -ef|grep 3306|grep -v grep|awk '{print $2}'|xargs kill -9
[root@128m ~]# ps -ef|grep 3306
root      773525   61755  0 13:48 pts/2    00:00:00 grep --color=auto 3306
[root@128m ~]# 

3306
配置service文件
[root@128m system]# pwd 
/usr/lib/systemd/system
[root@128m system]# 
[root@128m system]# vim sql3306.service [root@128m system]# cat sql3306.service 
[Unit]
Description=3306 server daemon
After=network.target sshd-keygen.target

[Service]
Type=forking
PATH=/usr/local/mysql/bin:$PATH
ExecStart=/usr/local/mysql/bin/mysqld_multi start 3306
ExecStop=ps -ef|grep 3306|grep -v grep|awk '{print $2}'|xargs kill -9
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

加载
[root@128m system]# systemctl daemon-reload

停掉服务
[root@128m ~]# ps -ef|grep 3306|grep -v grep|awk '{print $2}'|xargs kill -9

[root@128m ~]# ss -antl
State  Recv-Q Send-Q Local Address:Port Peer Address:PortProcess 
LISTEN 0      128          0.0.0.0:22        0.0.0.0:*           
LISTEN 0      128             [::]:22           [::]:*           
[root@128m ~]# systemctl start sql3306

服务打不开显示缺少环境变量,做一个软链接
[root@128m system]# systemctl status sql3306.service 
* sql3306.service - 3306 server daemon
   Loaded: loaded (/usr/lib/systemd/system/sql3306.service; disa>
   Active: inactive (dead)

* sql3306.service - 3306 server daemon
   Loaded: loaded (/usr/lib/systemd/system/sql3306.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sat 2022-07-02 16:56:53 CST; 5s ago
  Process: 70028 ExecStart=/usr/local/mysql/bin/mysqld_multi start 3306 (code=exited, status=1/FAILURE)

Jul 02 16:56:53 128m mysqld_multi[70028]: Please make sure you have this command available and
Jul 02 16:56:53 128m mysqld_multi[70028]: in your path. The command is available from the latest
Jul 02 16:56:53 128m mysqld_multi[70028]: MySQL distribution.
Jul 02 16:56:53 128m mysqld_multi[70028]: ABORT: Can't find command 'my_print_defaults'.
Jul 02 16:56:53 128m mysqld_multi[70028]: This command is available from the latest MySQL
Jul 02 16:56:53 128m mysqld_multi[70028]: distribution. Please make sure you have the command
Jul 02 16:56:53 128m mysqld_multi[70028]: in your PATH.

[root@128m ~]# ln -s /usr/local/mysql/bin/my_print_defaults /usr/bin/
[root@128m ~]# ss -antl
State  Recv-Q Send-Q Local Address:Port Peer Address:PortProcess 
LISTEN 0      128          0.0.0.0:22        0.0.0.0:*           
LISTEN 0      80                 *:3306            *:*           
LISTEN 0      128             [::]:22           [::]:*           
[root@128m ~]# systemctl status sql3306.service 
* sql3306.service - 3306 server daemon
   Loaded: loaded (/usr/lib/systemd/system/sql3306.service; disa>
   Active: active (running) since Sat 2022-07-02 17:03:40 CST; 2>
  Process: 98463 ExecStart=/usr/local/mysql/bin/mysqld_multi sta>
 Main PID: 98480 (mysqld_safe)
    Tasks: 28 (limit: 23502)
   Memory: 177.7M
   CGroup: /system.slice/sql3306.service
           |-98480 /bin/sh /usr/local/mysql/bin/mysqld_safe --da>
           `-98629 /usr/local/mysql/bin/mysqld --basedir=/usr/lo>

Jul 02 17:03:40 128m systemd[1]: Starting 3306 server daemon...
Jul 02 17:03:40 128m systemd[1]: Started 3306 server daemon.
[root@128m ~]#
    
设置开机自启
[root@128m ~]# systemctl enable --now sql3306
Created symlink /etc/systemd/system/multi-user.target.wants/sql3306.service -> /usr/lib/systemd/system/sql3306.service.
[root@128m ~]# systemctl status sql3306.service 
* sql3306.service - 3306 server daemon
   Loaded: loaded (/usr/lib/systemd/system/sql3306.service; enab>
   Active: active (running) since Sat 2022-07-02 17:03:40 CST; 9>
 Main PID: 98480 (mysqld_safe)
    Tasks: 28 (limit: 23502)
   Memory: 188.2M
   CGroup: /system.slice/sql3306.service
           |-98480 /bin/sh /usr/local/mysql/bin/mysqld_safe --da>
           `-98629 /usr/local/mysql/bin/mysqld --basedir=/usr/lo>

Jul 02 17:03:40 128m systemd[1]: Starting 3306 server daemon...
Jul 02 17:03:40 128m systemd[1]: Started 3306 server daemon.
Jul 02 17:10:45 128m systemd[1]: /usr/lib/systemd/system/sql3306>
Jul 02 17:12:39 128m systemd[1]: /usr/lib/systemd/system/sql3306>
[root@128m ~]# 
    
停掉服务
[root@128m ~]# systemctl stop sql3306
[root@128m ~]# systemctl status sql3306.service 
* sql3306.service - 3306 server daemon
   Loaded: loaded (/usr/lib/systemd/system/sql3306.service; enab>
   Active: failed (Result: exit-code) since Sat 2022-07-02 17:13>
  Process: 139184 ExecStop=/usr/bin/ps -ef|grep 3306|grep -v gre>
 Main PID: 98480 (code=exited, status=0/SUCCESS)

Jul 02 17:13:20 128m ps[139184]: error: unsupported SysV option
Jul 02 17:13:20 128m ps[139184]: Usage:
Jul 02 17:13:20 128m ps[139184]:  ps [options]
Jul 02 17:13:20 128m ps[139184]:  Try 'ps --help <simple|list|ou>
Jul 02 17:13:20 128m ps[139184]:   or 'ps --help <s|l|o|t|m|a>'
Jul 02 17:13:20 128m ps[139184]:  for additional help text.
Jul 02 17:13:20 128m ps[139184]: For more details see ps(1).
Jul 02 17:13:20 128m systemd[1]: sql3306.service: Control proces>
Jul 02 17:13:22 128m systemd[1]: sql3306.service: Failed with re>
Jul 02 17:13:22 128m systemd[1]: Stopped 3306 server daemon.
[root@128m ~]#       
2.2 3307和3308
[root@128m ~]# cd /usr/lib/systemd/system
[root@128m system]# cp sql3306.service sql3307.service 
[root@128m system]# cp sql3306.service sql3308.service 
[root@128m system]# 

3307
[root@128m system]# vim sql3307.service 
[root@128m system]# cat sql3307.service
[Unit]
Description=3307 server daemon
After=network.target sshd-keygen.target

[Service]
Type=forking
PATH=/usr/local/mysql/bin:$PATH
ExecStart=/usr/local/mysql/bin/mysqld_multi start 3307
ExecStop=ps -ef|grep 3307|grep -v grep|awk '{print $2}'|xargs kill -9
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target
[root@128m system]# 

3308
[root@128m system]# vim sql3308.service
[root@128m system]# cat sql3308.service 
[Unit]
Description=3308 server daemon
After=network.target sshd-keygen.target

[Service]
Type=forking
PATH=/usr/local/mysql/bin:$PATH
ExecStart=/usr/local/mysql/bin/mysqld_multi start 3308
ExecStop=ps -ef|grep 3308|grep -v grep|awk '{print $2}'|xargs kill -9
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target
[root@128m system]# 

[root@128m system]# systemctl daemon-reload
[root@128m system]# 

[root@128m ~]# ss -antl
State  Recv-Q Send-Q Local Address:Port Peer Address:PortProcess 
LISTEN 0      128          0.0.0.0:22        0.0.0.0:*           
LISTEN 0      80                 *:3306            *:*           
LISTEN 0      128             [::]:22           [::]:*           
[root@128m ~]# systemctl start sql3307
[root@128m ~]# systemctl start sql3308
[root@128m ~]# ss -antl
State  Recv-Q Send-Q Local Address:Port Peer Address:PortProcess 
LISTEN 0      128          0.0.0.0:22        0.0.0.0:*           
LISTEN 0      80                 *:3306            *:*           
LISTEN 0      80                 *:3307            *:*           
LISTEN 0      80                 *:3308            *:*           
LISTEN 0      128             [::]:22           [::]:*           
[root@128m ~]# 

设置开机自启
[root@128m ~]# systemctl enable --now sql3307
Created symlink /etc/systemd/system/multi-user.target.wants/sql3307.service -> /usr/lib/systemd/system/sql3307.service.
[root@128m ~]# systemctl enable --now sql3308
Created symlink /etc/systemd/system/multi-user.target.wants/sql3308.service -> /usr/lib/systemd/system/sql3308.service.
[root@128m ~]# 
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值