MySQL 5.7 多实例安装部署实例(2)

5. 启动测试
  * 查个多实例状态
[root@MySQL ~]# /etc/init.d/mysqld_multi report
Reporting MySQL servers
MySQL server from group: mysqld1 is not running
MySQL server from group: mysqld2 is not running
MySQL server from group: mysqld3 is not running
MySQL server from group: mysqld4 is not running

* 启动多实例
 [root@MySQL ~]# /etc/init.d/mysqld_multi start

* 查看多实例状态
Reporting MySQL servers
MySQL server from group: mysqld1 is running
MySQL server from group: mysqld2 is running
MySQL server from group: mysqld3 is running
MySQL server from group: mysqld4 is running

* 查看实例监听端口
[root@MySQL ~]# netstat -lntp | grep mysqld
tcp        0      0 0.0.0.0:3306        0.0.0.0:*                LISTEN      2673/mysqld       
tcp        0      0 0.0.0.0:3307        0.0.0.0:*                LISTEN      2676/mysqld       
tcp        0      0 0.0.0.0:3308        0.0.0.0:*                LISTEN      2679/mysqld       
tcp        0      0 0.0.0.0:3309        0.0.0.0:*                LISTEN      2682/mysqld

6. 连接测试
  * 实例1
[root@MySQL ~]# /usr/local/mysql/bin/mysql -S /tmp/mysql.sock1  -p'z+Ilo*>s:3kw'
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 6
Server version: 5.7.18
 
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
 
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 = '123456';
Query OK, 0 rows affected (0.00 sec)

  * 实例2
[root@MySQL ~]# /usr/local/mysql/bin/mysql -S /tmp/mysql.sock2  -p'b*AHUrTgu1rl'
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 7
Server version: 5.7.18
 
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
 
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 = '123456';
Query OK, 0 rows affected (0.00 sec)

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/857d6b06994adf87133901372e599cf4.html