启动服务
- [root@backup 3307]# /data/3306/mysql start
- Starting MySQL...
- [root@backup 3307]# lsof -i :3306
- COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
- mysqld 19986 mysql 10u IPv4 90967 0t0 TCP *:mysql (LISTEN)
- [root@backup 3307]# /data/3307/mysql
- start Starting MySQL...
- [root@backup 3307]# lsof -i :3307
- COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
- mysqld 21648 mysql 11u IPv4 92899 0t0 TCP *:opsession-prxy (LISTEN)
检查端口
- [root@backup 3307]# netstat -lntup|grep mysql
- tcp 0 0 0.0.0.0:3307 0.0.0.0:* LISTEN 21648/mysqld
- tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 19986/mysqld
登陆多实例数据库
- [root@backup ~]# mysql -S /data/3306/mysql.sock
- Welcome to the MySQL monitor. Commands end with ; or g.
- Your MySQL connection id is 1
- Server version: 5.5.51-log Source distribution
- Copyright (c) 2000, 2016, 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> create database data3306;
- Query OK, 1 row affected (0.00 sec)
- mysql> show databases;
- +--------------------+
- | Database |
- +--------------------+
- | information_schema |
- | data3306 |
- | mysql |
- | performance_schema |
- | test |
- +--------------------+
- 5 rows in set (0.00 sec)
- mysql> quit
- Bye
- [root@backup ~]# mysql -S /data/3307/mysql.sock
- Welcome to the MySQL monitor.
- Commands end with ; or g.
- Your MySQL connection id is 1
- Server version: 5.5.51 Source distribution
- Copyright (c) 2000, 2016, 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> show databases;
- +--------------------+
- | Database |
- +--------------------+
- | information_schema |
- | mysql |
- | performance_schema |
- | test |
- +--------------------+
- 4 rows in set (0.05 sec)
成功登陆,并在3306实例中创建数据库,但是3307实例上查看并没有创建过的数据,说明两个实例是独立的
注:如果再需要新增一个实例,基本的配置步骤同上述一样,只需要相应修改配置文件与启动程序文件中的端口号与数据目录的路径即可,最后可以将多实例数据库启动命令加入开机自启动。 (编辑:晋中站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|