MySQL主从读写分离之Proxysql(openEuler版)

实验目的:

基于proxysql实现MySQL的主从读写分离。

实验过程:

前期准备:

一共有四台虚拟机,其中三台为配置好的一主两从虚拟机,还有一台干净的虚拟机用来配置proxysql。

主机名地址
master192.168.27.137
node1192.168.27.139
node2192.168.27.140
proxysql192.168.27.141

proxysql下载:(此处链接为官方,也可进入percona或者github官网进行下载适合的版本)ProxySQL - A High Performance Open Source MySQL Proxyicon-default.png?t=N7T8https://www.proxysql.com/

实验过程:

在proxysql所在虚拟机配置:
下载并安装proxysql以及mysql客户端(mariadb):
[root@localhost ~]# yum install proxysql-2.5.5-1-centos8.x86_64.rpm
[root@localhost ~]# dnf install mariadb
启动proxysql服务:
[root@localhost ~]# systemctl enable --now proxysql
登录proxysql:
[root@localhost ~]# mysql -uadmin -padmin -h 127.0.0.1 -P 6032
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.30 (ProxySQL Admin Module)Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MySQL [(none)]> show databases;//查看数据库
+-----+---------------+-------------------------------------+
| seq | name          | file                                |
+-----+---------------+-------------------------------------+
| 0   | main          |                                     |
| 2   | disk          | /var/lib/proxysql/proxysql.db       |
| 3   | stats         |                                     |
| 4   | monitor       |                                     |
| 5   | stats_history | /var/lib/proxysql/proxysql_stats.db |
+-----+---------------+-------------------------------------+
5 rows in set (0.000 sec)
可见有五个库: main、disk、stats 、monitor 和 stats_history
main: 内存配置数据库,即 MEMORY,表里存放后端 db 实例、用户验证、路由规则等信息。main 库中有如下信息:
MySQL [(none)]> show tables from main;
+----------------------------------------------------+
| tables                                             |
+----------------------------------------------------+
| coredump_filters                                   |
| global_variables                                   |
| mysql_aws_aurora_hostgroups                        |
| mysql_collations                                   |
| mysql_firewall_whitelist_rules                     |
| mysql_firewall_whitelist_sqli_fingerprints         |
| mysql_firewall_whitelist_users                     |
| mysql_galera_hostgroups                            |
| mysql_group_replication_hostgroups                 |
| mysql_hostgroup_attributes                         |
| mysql_query_rules                                  |
| mysql_query_rules_fast_routing                     |
| mysql_replication_hostgroups                       |
| mysql_servers                                      |
| mysql_users                                        |
| proxysql_servers                                   |
| restapi_routes                                     |
| runtime_checksums_values                           |
| runtime_coredump_filters                           |
| runtime_global_variables                           |
| runtime_mysql_aws_aurora_hostgroups                |
| runtime_mysql_firewall_whitelist_rules             |
| runtime_mysql_firewall_whitelist_sqli_fingerprints |
| runtime_mysql_firewall_whitelist_users             |
| runtime_mysql_galera_hostgroups                    |
| runtime_mysql_group_replication_hostgroups         |
| runtime_mysql_hostgroup_attributes                 |
| runtime_mysql_query_rules                          |
| runtime_mysql_query_rules_fast_routing             |
| runtime_mysql_replication_hostgroups               |
| runtime_mysql_servers                              |
| runtime_mysql_users                                |
| runtime_proxysql_servers                           |
| runtime_restapi_routes                             |
| runtime_scheduler                                  |
| scheduler                                          |
+----------------------------------------------------+
36 rows in set (0.001 sec)
mysql_servers: 后端可以连接 MySQL 服务器的列表
mysql_users: 配置后端数据库的账号和监控的账号。
mysql_query_rules: 指定 Query 路由到后端不同服务器的规则列表。
注: 表名以 runtime_开头的表示 ProxySQL 当前运行的配置内容,不能通过 DML 语句修改。
只能修改对应的不以 runtime 开头的表,然后 “LOAD” 使其生效,“SAVE” 使其存到硬盘以供下次重启加载。
在主库(master)中的配置:
创建proxysql的监控账户和对外访问账户:
mysql> create user 'monitor'@'192.168.%.%' identified with mysql_native_password by 'Monitor@123.com';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on *.* to 'monitor'@'192.168.%.%' with grant option;
Query OK, 0 rows affected (0.01 sec)
mysql> create user 'proxysql'@'192.168.%.%' identified with mysql_native_password by '123456';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on *.* to 'proxysql'@'192.168.%.%' with grant option;
Query OK, 0 rows affected (0.00 sec)
配置proxysql:
查看需要用到的表的表结构:
MySQL [(none)]> show create table mysql_replication_hostgroups \G
*************************** 1. row ***************************table: mysql_replication_hostgroups
Create Table: CREATE TABLE mysql_replication_hostgroups (writer_hostgroup INT CHECK (writer_hostgroup>=0) NOT NULL PRIMARY KEY,reader_hostgroup INT NOT NULL CHECK (reader_hostgroup<>writer_hostgroup AND reader_hostgroup>=0),check_type VARCHAR CHECK (LOWER(check_type) IN ('read_only','innodb_read_only','super_read_only','read_only|innodb_read_only','read_only&innodb_read_only')) NOT NULL DEFAULT 'read_only',comment VARCHAR NOT NULL DEFAULT '', UNIQUE (reader_hostgroup))
1 row in set (0.000 sec)
创建新的组(定义写为1,读为0)
MySQL [(none)]>  insert into mysql_replication_hostgroups (writer_hostgroup,reader_hostgroup,comment) values (1,0,'proxy');
Query OK, 1 row affected (0.000 sec)
MySQL [(none)]> load mysql servers to runtime;//加载到当前生效
Query OK, 0 rows affected (0.003 sec)
MySQL [(none)]> save mysql servers to disk;//持久化保存
Query OK, 0 rows affected (0.018 sec)
ProxySQL会根据server的read_only的取值将服务器进行分组。read_only=0的server,master被分到编号为1的写组,read_only=1的server,slave则分到编号为0的读组
MySQL [(none)]> select * from mysql_replication_hostgro
+------------------+------------------+------------+---
| writer_hostgroup | reader_hostgroup | check_type | co
+------------------+------------------+------------+---
| 1                | 0                | read_only  | pr
+------------------+------------------+------------+---
1 row in set (0.000 sec)
添加主从服务器节点:
MySQL [(none)]> insert into mysql_servers(hostgroup_id,hostname,port) values (1,'192.168.27.137',3306);
Query OK, 1 row affected (0.000 sec)
MySQL [(none)]>  insert into mysql_servers(hostgroup_id,hostname,port) values (0,'192.168.27.139',3306);
Query OK, 1 row affected (0.000 sec)
MySQL [(none)]> insert into mysql_servers(hostgroup_id,hostname,port) values (0,'192.168.27.140',3306);
Query OK, 1 row affected (0.000 sec)
MySQL [(none)]> load mysql servers to runtime;
Query OK, 0 rows affected (0.002 sec)
MySQL [(none)]> save mysql servers to disk;
Query OK, 0 rows affected (0.015 sec)
MySQL [(none)]>  select * from mysql_servers;
+--------------+----------------+------+-----------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname       | port | gtid_port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+----------------+------+-----------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| 1            | 192.168.27.137 | 3306 | 0         | ONLINE | 1      | 0           | 1000            | 0                   | 0       | 0              |         |
| 0            | 192.168.27.139 | 3306 | 0         | ONLINE | 1      | 0           | 1000            | 0                   | 0       | 0              |         |
| 0            | 192.168.27.140 | 3306 | 0         | ONLINE | 1      | 0           | 1000            | 0                   | 0       | 0              |         |
+--------------+----------------+------+-----------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
3 rows in set (0.000 sec)
为proxysql监控mysql后端节点:
MySQL [(none)]> use monitor//使用monitor
Database changed
MySQL [monitor]> set mysql-monitor_username='monitor';//创建用户 
Query OK, 1 row affected (0.000 sec)
MySQL [monitor]> set mysql-monitor_password='Monitor@123.com';//填写密码
Query OK, 1 row affected (0.000 sec)
MySQL [monitor]>  load mysql variables to runtime;//加载到当前
Query OK, 0 rows affected (0.001 sec)
MySQL [monitor]> save mysql variables to disk;//持久化保存
Query OK, 158 rows affected (0.003 sec)
MySQL [monitor]> select @@mysql-monitor_username;//查看用户名
+--------------------------+
| @@mysql-monitor_username |
+--------------------------+
| monitor                  |
+--------------------------+
1 row in set (0.001 sec)
MySQL [monitor]> select @@mysql-monitor_password;//查看密码
+--------------------------+
| @@mysql-monitor_password |
+--------------------------+
| Monitor@123.com          |
+--------------------------+
1 row in set (0.001 sec)
MySQL [monitor]> select * from monitor.mysql_server_connect_log;//查看日志信息
+----------------+------+------------------+-------------------------+-------------------------------------------------------------------------+
| hostname       | port | time_start_us    | connect_success_time_us | connect_error                                                           |
+----------------+------+------------------+-------------------------+-------------------------------------------------------------------------+
| 192.168.27.140 | 3306 | 1709796180625505 | 0                       | Access denied for user 'monitor'@'192.168.27.141' (using password: YES) |
| 192.168.27.137 | 3306 | 1709796181067381 | 0                       | Access denied for user 'monitor'@'192.168.27.141' (using password: YES) |
| 192.168.27.139 | 3306 | 1709796181508932 | 0                       | Access denied for user 'monitor'@'192.168.27.141' (using password: YES) |
| 192.168.27.140 | 3306 | 1709796240626303 | 0                       | Access denied for user 'monitor'@'192.168.27.141' (using password: YES) |
| 192.168.27.137 | 3306 | 1709796241217740 | 0                       | Access denied for user 'monitor'@'192.168.27.141' (using password: YES) |
| 192.168.27.139 | 3306 | 1709796241809274 | 0                       | Access denied for user 'monitor'@'192.168.27.141' (using password: YES) |
| 192.168.27.139 | 3306 | 1709796300626918 | 0                       | Access denied for user 'monitor'@'192.168.27.141' (using password: YES) |
| 192.168.27.137 | 3306 | 1709796301097796 | 0                       | Access denied for user 'monitor'@'192.168.27.141' (using password: YES) |
| 192.168.27.140 | 3306 | 1709796301568472 | 0                       | Access denied for user 'monitor'@'192.168.27.141' (using password: YES) |
| 192.168.27.139 | 3306 | 1709796306543844 | 1884                    | NULL                                                                    |
| 192.168.27.140 | 3306 | 1709796307338491 | 1778                    | NULL                                                                    |
| 192.168.27.137 | 3306 | 1709796308132494 | 1261                    | NULL                                                                    |
| 192.168.27.137 | 3306 | 1709796366544441 | 1317                    | NULL                                                                    |
| 192.168.27.139 | 3306 | 1709796367110254 | 1339                    | NULL                                                                    |
| 192.168.27.140 | 3306 | 1709796367683285 | 1771                    | NULL                                                                    |
+----------------+------+------------------+-------------------------+-------------------------------------------------------------------------+
15 rows in set (0.000 sec)
查看心跳信息:
MySQL [monitor]> select * from mysql_server_ping_log;
+----------------+------+------------------+--------------------------+
| hostname       | port | time_start_us    | ping_succe               |
+----------------+------+------------------+--------------------------+
| 192.168.27.140 | 3306 | 1709796150706279 | 0         password: YES) |
| 192.168.27.139 | 3306 | 1709796150706317 | 0         password: YES) |
| 192.168.27.137 | 3306 | 1709796150707742 | 0         password: YES) |
| 192.168.27.139 | 3306 | 1709796160707187 | 0         password: YES) |
| 192.168.27.137 | 3306 | 1709796160707414 | 0         password: YES) |
| 192.168.27.140 | 3306 | 1709796160709026 | 0         password: YES) |
| 192.168.27.140 | 3306 | 1709796170707830 | 0         password: YES) |
| 192.168.27.137 | 3306 | 1709796170707893 | 0         password: YES) |
| 192.168.27.139 | 3306 | 1709796170709330 | 0         password: YES) |
| 192.168.27.140 | 3306 | 1709796180708671 | 0         password: YES) |
| 192.168.27.139 | 3306 | 1709796180708437 | 0         password: YES) |
| 192.168.27.137 | 3306 | 1709796180711690 | 0         password: YES) |
| 192.168.27.137 | 3306 | 1709796190709041 | 0         password: YES) |
| 192.168.27.140 | 3306 | 1709796190709143 | 0         password: YES) |
| 192.168.27.139 | 3306 | 1709796190710542 | 0         password: YES) |
| 192.168.27.137 | 3306 | 1709796200709720 | 0         password: YES) |
| 192.168.27.139 | 3306 | 1709796200709721 | 0         password: YES) |
| 192.168.27.140 | 3306 | 1709796200710996 | 0         password: YES) |
| 192.168.27.140 | 3306 | 1709796210710277 | 0         password: YES) |
| 192.168.27.137 | 3306 | 1709796210710291 | 0         password: YES) |
| 192.168.27.139 | 3306 | 1709796210711528 | 0         password: YES) |
| 192.168.27.137 | 3306 | 1709796220711158 | 0         password: YES) |
| 192.168.27.140 | 3306 | 1709796220711010 | 0         password: YES) |
| 192.168.27.139 | 3306 | 1709796220712626 | 0         password: YES) |
| 192.168.27.140 | 3306 | 1709796230711681 | 0         password: YES) |
| 192.168.27.137 | 3306 | 1709796230711766 | 0         password: YES) |
| 192.168.27.139 | 3306 | 1709796230712791 | 0         password: YES) |
| 192.168.27.139 | 3306 | 1709796240712290 | 0         password: YES) |
| 192.168.27.137 | 3306 | 1709796240712403 | 0         password: YES) |
| 192.168.27.140 | 3306 | 1709796240714933 | 0         password: YES) |
| 192.168.27.140 | 3306 | 1709796250712823 | 0         password: YES) |
| 192.168.27.139 | 3306 | 1709796250712816 | 0         password: YES) |
| 192.168.27.137 | 3306 | 1709796250714279 | 0         password: YES) |
| 192.168.27.139 | 3306 | 1709796260713537 | 0         password: YES) |
| 192.168.27.137 | 3306 | 1709796260713528 | 0         password: YES) |
| 192.168.27.140 | 3306 | 1709796260715467 | 0         password: YES) |
| 192.168.27.140 | 3306 | 1709796270714115 | 0         password: YES) |
| 192.168.27.139 | 3306 | 1709796270714202 | 0         password: YES) |
| 192.168.27.137 | 3306 | 1709796270715440 | 0         password: YES) |
| 192.168.27.140 | 3306 | 1709796280714926 | 0         password: YES) |
| 192.168.27.139 | 3306 | 1709796280715011 | 0         password: YES) |
| 192.168.27.137 | 3306 | 1709796280716414 | 0         password: YES) |
| 192.168.27.140 | 3306 | 1709796290715577 | 0         password: YES) |
| 192.168.27.137 | 3306 | 1709796290715497 | 0         password: YES) |
| 192.168.27.139 | 3306 | 1709796290718626 | 0         password: YES) |
| 192.168.27.140 | 3306 | 1709796300716091 | 0         password: YES) |
| 192.168.27.137 | 3306 | 1709796300716161 | 0         password: YES) |
| 192.168.27.139 | 3306 | 1709796300717430 | 0         password: YES) |
| 192.168.27.137 | 3306 | 1709796306725083 | 234                      |
| 192.168.27.140 | 3306 | 1709796306725072 | 160                      |
| 192.168.27.139 | 3306 | 1709796306725193 | 132                      |
| 192.168.27.137 | 3306 | 1709796316725952 | 436                      |
| 192.168.27.139 | 3306 | 1709796316726154 | 259                      |
| 192.168.27.140 | 3306 | 1709796316726119 | 301                      |
| 192.168.27.140 | 3306 | 1709796326726613 | 501                      |
| 192.168.27.139 | 3306 | 1709796326726788 | 353                      |
| 192.168.27.137 | 3306 | 1709796326726752 | 396                      |
| 192.168.27.137 | 3306 | 1709796336726831 | 425                      |
| 192.168.27.140 | 3306 | 1709796336726960 | 319                      |
| 192.168.27.139 | 3306 | 1709796336726942 | 343                      |
| 192.168.27.140 | 3306 | 1709796346742368 | 1308                     |
| 192.168.27.139 | 3306 | 1709796346742539 | 1165                     |
| 192.168.27.137 | 3306 | 1709796346742517 | 1197                     |
| 192.168.27.137 | 3306 | 1709796356743147 | 547                      |
| 192.168.27.140 | 3306 | 1709796356743301 | 425                      |
| 192.168.27.139 | 3306 | 1709796356743278 | 459                      |
| 192.168.27.137 | 3306 | 1709796366743429 | 407                      |
| 192.168.27.140 | 3306 | 1709796366743562 | 291                      |
| 192.168.27.139 | 3306 | 1709796366743545 | 314                      |
| 192.168.27.140 | 3306 | 1709796376745397 | 868                      |
| 192.168.27.139 | 3306 | 1709796376745537 | 752                      |
| 192.168.27.137 | 3306 | 1709796376745518 | 778                      |
| 192.168.27.139 | 3306 | 1709796386745976 | 521                      |
| 192.168.27.140 | 3306 | 1709796386746122 | 406                      |
| 192.168.27.137 | 3306 | 1709796386746109 | 428                      |
| 192.168.27.140 | 3306 | 1709796396746574 | 1349                     |
| 192.168.27.137 | 3306 | 1709796396746710 | 1239                     |
| 192.168.27.139 | 3306 | 1709796396746690 | 1266                     |
| 192.168.27.137 | 3306 | 1709796406747306 | 1100                     |
| 192.168.27.139 | 3306 | 1709796406747510 | 944                      |
| 192.168.27.140 | 3306 | 1709796406747486 | 979                      |
| 192.168.27.139 | 3306 | 1709796416748048 | 431                      |
| 192.168.27.137 | 3306 | 1709796416748195 | 305                      |
| 192.168.27.140 | 3306 | 1709796416748215 | 291                      |
| 192.168.27.139 | 3306 | 1709796426748430 | 797                      |
| 192.168.27.137 | 3306 | 1709796426748565 | 684                      |
| 192.168.27.140 | 3306 | 1709796426748549 | 707                      |
| 192.168.27.140 | 3306 | 1709796436748942 | 551                      |
| 192.168.27.139 | 3306 | 1709796436749096 | 428                      |
| 192.168.27.137 | 3306 | 1709796436749075 | 457                      |
| 192.168.27.139 | 3306 | 1709796446749755 | 677                      |
| 192.168.27.140 | 3306 | 1709796446749900 | 561                      |
| 192.168.27.137 | 3306 | 1709796446749880 | 590                      |
| 192.168.27.137 | 3306 | 1709796456753858 | 1380                     |
| 192.168.27.139 | 3306 | 1709796456754148 | 1129                     |
| 192.168.27.140 | 3306 | 1709796456754111 | 1176                     |
| 192.168.27.140 | 3306 | 1709796466754180 | 882                      |
| 192.168.27.137 | 3306 | 1709796466754360 | 741                      |
| 192.168.27.139 | 3306 | 1709796466754339 | 769                      |
| 192.168.27.137 | 3306 | 1709796476755056 | 389                      |
| 192.168.27.139 | 3306 | 1709796476755239 | 229                      |
| 192.168.27.140 | 3306 | 1709796476755187 | 294                      |
| 192.168.27.139 | 3306 | 1709796486755641 | 441                      |
| 192.168.27.137 | 3306 | 1709796486755703 | 397                      |
| 192.168.27.140 | 3306 | 1709796486755684 | 422                      |
| 192.168.27.137 | 3306 | 1709796496755840 | 479                      |
| 192.168.27.140 | 3306 | 1709796496756003 | 381                      |
| 192.168.27.139 | 3306 | 1709796496755990 | 401                      |
| 192.168.27.139 | 3306 | 1709796506756185 | 348                      |
| 192.168.27.137 | 3306 | 1709796506756298 | 260                      |
| 192.168.27.140 | 3306 | 1709796506756313 | 252                      |
| 192.168.27.140 | 3306 | 1709796516756932 | 517                      |
| 192.168.27.139 | 3306 | 1709796516757138 | 331                      |
| 192.168.27.137 | 3306 | 1709796516757160 | 367                      |
| 192.168.27.140 | 3306 | 1709796526757309 | 337                      |
| 192.168.27.139 | 3306 | 1709796526757433 | 236                      |
| 192.168.27.137 | 3306 | 1709796526757417 | 258                      |
| 192.168.27.139 | 3306 | 1709796536757782 | 458                      |
| 192.168.27.137 | 3306 | 1709796536757910 | 349                      |
| 192.168.27.140 | 3306 | 1709796536757894 | 372                      |
| 192.168.27.140 | 3306 | 1709796546758288 | 477                      |
| 192.168.27.137 | 3306 | 1709796546758460 | 327                      |
| 192.168.27.139 | 3306 | 1709796546758436 | 358                      |
| 192.168.27.137 | 3306 | 1709796556758969 | 473                      |
| 192.168.27.139 | 3306 | 1709796556759144 | 345                      |
| 192.168.27.140 | 3306 | 1709796556759119 | 377                      |
| 192.168.27.140 | 3306 | 1709796566759542 | 440                      |
| 192.168.27.137 | 3306 | 1709796566759671 | 330                      |
| 192.168.27.139 | 3306 | 1709796566759654 | 355                      |
+----------------+------+------------------+--------------------------+
129 rows in set (0.000 sec)
查看read_only监控:
MySQL [monitor]> select * from mysql_server_read_only_log;//此次查询结果报错信息全为0需要进行过更改
对两个从服务器的配置文件进行更改,添加read_only=1让两从文件只课读:
mysql> system vim /etc/my.cnf
mysql> system systemctl restart mysql
再次查看read_only表信息:|
| 192.168.27.137 | 3306 | 1709796956508275 | 485             | 0         | NULL                                                                                        |
| 192.168.27.139 | 3306 | 1709796956508323 | 446             | 1         | NULL                                                                                        |
| 192.168.27.139 | 3306 | 1709796958008641 | 627             | 1         | NULL                                                                                        |
| 192.168.27.140 | 3306 | 1709796958008789 | 516             | 1         | NULL                                                                                        |
| 192.168.27.137 | 3306 | 1709796958008776 | 542             | 0         | NULL    
proxysql配置对外访问账号:
MySQL [monitor]> insert into 
mysql_users(username,password,default_hostgroup,transaction_persistent) values ('proxysql','123456',1,1);
Query OK, 1 row affected (0.000 sec)
MySQL [monitor]> load mysql users to runtime;
Query OK, 0 rows affected (0.000 sec)
MySQL [monitor]> save mysql users to disk;
Query OK, 0 rows affected (0.011 sec)
MySQL [monitor]> select * from mysql_users\G
*************************** 1. row ***************************username: proxysqlpassword: 123456active: 1use_ssl: 0default_hostgroup: 1default_schema: NULLschema_locked: 0
transaction_persistent: 1fast_forward: 0backend: 1frontend: 1max_connections: 10000attributes: comment: 
1 row in set (0.000 sec)
在从库192.168.27.139上通过对方询问账号proxysql连接,是否路由能默认到写组:
[root@node1 ~]# mysql -h192.168.27.141 -uproxysql -p'123456' -P 6033
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.5.30 (ProxySQL)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> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| school             |
| sys                |
+--------------------+
5 rows in set (0.01 sec)mysql> select @@server_id;
+-------------+
| @@server_id |
+-------------+
|           1 |
+-------------+
1 row in set (0.00 sec)mysql> create database keme;
Query OK, 1 row affected (0.01 sec)
在从库192.168.27.140上进行验证看是否能查看到keme:
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| keme               |
| mysql              |
| performance_schema |
| school             |
| sys                |
+--------------------+
6 rows in set (0.00 sec)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/526249.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

C语言笔记:文件的操作各种文件函数讲解

突然发现自己的C语言文件部分还没有学&#xff0c;赶紧来补一下~~ 1.文件分类 文本文件磁盘文件&#xff08;二进制文件&#xff09;C语言特殊文件标识&#xff1a;stdin&#xff08;标准输入&#xff1a;通指键盘输入&#xff09;&#xff0c;stdout&#xff08;标准输出&am…

【HarmonyOS】ArkTS-联合类型

目录 联合类型实例 联合类型 联合类型是一种灵活的数据类型&#xff0c;它修饰的变量可以存储不同类型的数据。 语法&#xff1a;let 变量: 类型1 | 类型2 | 类型3 值 基于联合类型&#xff0c;变量可存不同类型数据 实例 // 需求&#xff1a;定义一个变量&#xff0c;存放…

Building Systems with the ChatGPT API

Building Systems with the ChatGPT API 本文是 https://www.deeplearning.ai/short-courses/building-systems-with-chatgpt/ 这门课程的学习笔记。 文章目录 Building Systems with the ChatGPT APIWhat you’ll learn in this course Language Models, the Chat Format and…

【编译原理】1、python 实现一个 JSON parser:lex 词法分析、parser 句法分析

文章目录 一、实现 JSON lexer&#xff08;词法解析器&#xff09;二、lex 词法分析2.1 lex string 解析2.2 lex number 解析2.3 lex bool 和 null 解析 三、syntax parser 句法分析3.1 parse array 解析数组3.2 parse object 解析对象 四、封装接口 一、实现 JSON lexer&#…

运维随录实战(12)之node版本管理工具nvm

1,下载安装nvm 可以去其 github 主页下在,地址为 github.com/coreybutler…会看到有很多个文件可供选择: 这里稍做下解释: nvm-noinstall.zip: 这个是绿色版本,不需要安装,但是使用之前需要配置环境变量;nvm-setup.zip:推荐下载这个包,无需配置就可以使用;Source …

Mint_21.3 drawing-area和goocanvas的FB笔记(七)

FreeBASIC gfx 基本 graphics 绘图 8、ScreenControl与屏幕窗口位置设置 FreeBASIC通过自建屏幕窗口摆脱了原来的屏幕模式限制&#xff0c;既然是窗口&#xff0c;在屏幕坐标中就有它的位置。ScreenControl GET_WINDOW_POS x, y 获取窗口左上角的x, y位置&#xff1b;ScreenC…

深度学习+感知机

深度学习感知机 1感知机总结 2多层感知机1XOR2激活函数3多类分类总结 3代码实现 1感知机 是个很简单的模型,是个二分类的问题。 感知机&#xff08;perceptron&#xff09;是Frank Rosenblatt在1957年提出的一种人工神经网络&#xff0c;被视为一种最简单形式的前馈神经网络&…

【亲测有效】解决三月八号ChatGPT 发消息无响应!

背景 今天忽然发现 ChatGPT 无法发送消息&#xff0c;能查看历史对话&#xff0c;但是无法发送消息。 可能的原因 出现这个问题的各位&#xff0c;应该都是点击登录后顶部弹窗邀请 [加入多语言 alapha 测试] 了&#xff0c;并且语言选择了中文&#xff0c;抓包看到 ab.chatg…

Linux篇:文件系统和软硬连接

一 前置知识 文件文件内容文件属性 磁盘上存储文件存文件的内容&#xff08;数据块&#xff09;存文件的属性&#xff08;inode&#xff09; Linux的文件在磁盘中存储是将属性和内容分开存储的。文件内容的存储是给每个文件分配一块空间&#xff0c;此空间就叫数据块。文件属性…

C++primer -拷贝控制

拷贝控制成员&#xff1a;类通过五种函数来控制拷贝、移动、赋值和销毁&#xff1a;拷贝构造函数、拷贝赋值运算符、移动构造函数、移动赋值运算符、析构函数 合成拷贝控制成员&#xff1a; 若一个类未显式定义拷贝控制成员&#xff0c;编译器会自动生成合成版本&#xff1b; …

ActiveRAG—主动学习

原文地址&#xff1a;ActiveRAG — Active Learning 2024 年 2 月 26 日 大型语言模型&#xff08;LLM&#xff09;的出现开创了对话式人工智能的新时代。这些模型可以生成非常类似人类的文本&#xff0c;并且比以往更好地进行对话。然而&#xff0c;他们仍然面临着仅仅依靠预先…

JVM知识整体学习

前言&#xff1a;本篇没有任何建设性的想法&#xff0c;只是我很早之前在学JVM时记录的笔记&#xff0c;只是想从个人网站迁移过来。文章其实就是对《深入理解JVM虚拟机》的提炼&#xff0c;纯基础知识&#xff0c;网上一搜一大堆。 一、知识点脑图 本文只谈论HotSpots虚拟机。…