MySQL主从复制读写分离与高可用配置(4)

模拟通过proxysql使用数据库
[root@proxysql ]# mysql -h172.16.3.175 -umyadmin -pmypass
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 17406
Server version: 5.7.21-log MySQL Community Server (GPL)
Copyright (c) 2000, 2018, 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>

mysql > show databases;
mysql> show databases;
+--------------------+
| Database          |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| study              |
| sys                |
+--------------------+
5 rows in set (0.00 sec)
###删除study数据库user_info中6 -12之间的数据
删除之前:
mysql> select * from user_info;
+-----+-------+------+--------+----------+
| nid | name  | age  | gender | part_nid |
+-----+-------+------+--------+----------+
|  1 | san  |  20 | 男    |        1 |
|  2 | dong  |  29 | 男    |        2 |
|  4 | Ling  |  28 | 男    |        4 |
|  5 | ling  |  28 | 男    |        3 |
|  6 | dong  |  30 | 男    |        1 |
|  7 | b    |  11 | 女    |        1 |
|  8 | c    |  12 | 女    |        1 |
|  9 | d    |  18 | 女    |        4 |
|  10 | e    |  22 | 男    |        3 |
|  11 | f    |  23 | 男    |        2 |
|  12 | dongy |  22 | 男    |        1 |
+-----+-------+------+--------+----------+
11 rows in set (0.00 sec)
删除之后:
mysql> delete from user_info where nid >6 and nid <12;
Query OK, 5 rows affected (0.03 sec)

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

转载注明出处:https://www.heiqu.com/450fffd99d0341c45c0e4fbeb23f370f.html