当前位置: 首页 > news >正文

2024年8月7日(mysql主从 )

回顾
主服务器

[root@master_mysql ~]# yum -y install rsync

[root@master_mysql ~]# tar -xf mysql-8.0.33-linux-glibc2.12-x86_64.tar 

[root@master_mysql ~]# tar -xf mysql-8.0.33-linux-glibc2.12-x86_64.tar.xz

[root@master_mysql ~]# cp -r mysql-8.0.33-linux-glibc2.12-x86_64 /usr/local/mysql
[root@master_mysql ~]# cd /usr/local/mysql/
[root@master_mysql mysql]# mkdir mysql-files
[root@master_mysql mysql]# useradd -r -s /sbin/nologin mysql

[root@master_mysql mysql]# id mysql
uid=997(mysql) gid=995(mysql) 组=995(mysql)
[root@master_mysql mysql]# chown mysql:mysql ./mysql-files/

[root@master_mysql mysql]# rm -rf /etc/my.cnf
[root@master_mysql mysql]# ./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql/

[root@master_mysql mysql]# ./bin/mysql_ssl_rsa_setup --datadir=/usr/local/mysql/data

[root@master_mysql mysql]# cp support-files/mysql.server /etc/init.d/mysql8

[root@master_mysql mysql]# vim my.cnf

[mysqld]
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
socket=/tmp/mysql.sock
port=3306
log-error=/usr/local/mysql/data/db01-master.err
log-bin=/usr/local/mysql/data/binlog
server-id=10
character_set_server=utf8mb4

[root@master_mysql mysql]# service mysql8 start
. SUCCESS! 
[root@master_mysql mysql]# ./bin/mysql -P 3306 -p

mysql> alter user 'root'@'localhost' identified by '123456';
mysql> exit

[root@master_mysql mysql]# service mysql8 restart
Shutting down MySQL. SUCCESS! 
Starting MySQL.. SUCCESS! 

从服务器(不用初始化也不用启动)

[root@slave_mysql ~]# yum -y install rsync

[root@slave_mysql ~]# tar -xf mysql-8.0.33-linux-glibc2.12-x86_64.tar 
[root@slave_mysql ~]# tar -xf mysql-8.0.33-linux-glibc2.12-x86_64.tar.xz

[root@slave_mysql ~]# cp -r mysql-8.0.33-linux-glibc2.12-x86_64 /usr/local/mysql
[root@slave_mysql ~]# useradd -r -s /sbin/nologin mysql
[root@slave_mysql ~]# mkdir /usr/local/mysql/mysql-files
[root@slave_mysql ~]# chown mysql:mysql /usr/local/mysql/mysql-files/

[root@slave_mysql ~]# rm -rf /etc/my.cnf
[root@slave_mysql ~]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql8

主服务器(同步)

[root@master_mysql ~]# rm -rf /usr/local/mysql/data/auto.cnf 
[root@master_mysql ~]# service mysql8 stop
Shutting down MySQL. SUCCESS! 
[root@master_mysql ~]# rm -rf /usr/local/mysql/data/auto.cnf 
[root@master_mysql ~]# ls /usr/local/mysql/data/
[root@master_mysql ~]# rsync -av /usr/local/mysql/data root@192.168.8.165:/usr/local/mysql/  #从服务器IP地址

从服务器

[root@slave_mysql ~]# vim /usr/local/mysql/data/my.cnf

[mysqld]
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
socket=/tmp/mysql.sock
log-error=/usr/local/mysql/data/err.log
log-relay=/usr/local/mysql/data/relaylog
character_set_server=utf8mb4
server-id=11

[root@slave_mysql ~]# service mysql8 start

[root@slave_mysql ~]# /usr/local/mysql/bin/mysql -p123456

1、 主从复制的实现

 [root@master_mysql ~]# vim /etc/profile

export PATH=/usr/local/mysql/bin:$PATH

[root@master_mysql ~]# sorce /etc/profile

mysql> create user 'slave'@'192.168.8.%' identified by 'slave_123'
';
Query OK, 0 rows affected (0.01 sec)mysql> grant replication slave on *.* to 'slave'@'192.168.8.%';
Query OK, 0 rows affected (0.01 sec)mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)mysql> flush tables with read lock;
Query OK, 0 rows affected (0.00 sec)
mysql> show master status;

[root@slave_mysql ~]# vim /etc/profile

export PATH=/usr/local/mysql/bin:$PATH

[root@slave_mysql ~]# source /etc/profile 

[root@slave_mysql ~]# mysql -h192.168.8.164 -uslave -pslave_123 --get-server-public-key

[root@slave_mysql ~]# mysql -p123456 -P3306

mysql> stop slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> reset slave;
Query OK, 0 rows affected, 1 warning (0.01 sec)mysql> change master to-> master_host='192.168.8.164',-> master_user='slave',-> master_password='slave_123',-> master_log_file='binlog.000009',-> master_log_pos=447;
Query OK, 0 rows affected, 8 warnings (0.00 sec)mysql> start slave;
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> show slave status\G;
2、主服务器创建表并向表里添加数据
mysql> unlock tables;
Query OK, 0 rows affected (0.00 sec)mysql> create database if not exists test charset utf8mb4;
Query OK, 1 row affected (0.00 sec)mysql> use test;
Database changed
mysql> create table student(id int primary key,name varchar(45) not null,gender varchar(4) not null);
Query OK, 0 rows affected (0.01 sec)mysql> insert into student values(1,'张三','男');
Query OK, 1 row affected (0.02 sec)mysql> insert into student values(2,'凤凰','女');
Query OK, 1 row affected (0.01 sec)mysql> insert into student values(3,'张三','男');
Query OK, 1 row affected (0.00 sec)
mysql> select * from student;
+----+--------+--------+
| id | name   | gender |
+----+--------+--------+
|  1 | 张三   | 男     |
|  2 | 凤凰   | 女     |
|  3 | 张三   | 男     |
+----+--------+--------+
3 rows in set (0.00 sec)
3、从服务器查看同步并写入东西(从服务器不容许写入东西)
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| test               |
+--------------------+
5 rows in set (0.00 sec)mysql> use test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql> select * from student;
+----+--------+--------+
| id | name   | gender |
+----+--------+--------+
|  1 | 张三   | 男     |
|  2 | 凤凰   | 女     |
|  3 | 张三   | 男     |
+----+--------+--------+
3 rows in set (0.00 sec)mysql> insert into student values(4,'李网','女');
Query OK, 1 row affected (0.00 sec)mysql> select * from student;
+----+--------+--------+
| id | name   | gender |
+----+--------+--------+
|  1 | 张三   | 男     |
|  2 | 凤凰   | 女     |
|  3 | 张三   | 男     |
|  4 | 李网   | 女     |
+----+--------+--------+
4 rows in set (0.00 sec)
4、主服务器插入数据
mysql> insert into student values(6,'章节','男');
Query OK, 1 row affected (0.01 sec)mysql> select * from student;
+----+--------+--------+
| id | name   | gender |
+----+--------+--------+
|  1 | 张三   | 男     |
|  2 | 凤凰   | 女     |
|  3 | 张三   | 男     |
|  6 | 章节   | 男     |
+----+--------+--------+
4 rows in set (0.00 sec)
5、从服务器查看同步
mysql> select * from student;
+----+--------+--------+
| id | name   | gender |
+----+--------+--------+
|  1 | 张三   | 男     |
|  2 | 凤凰   | 女     |
|  3 | 张三   | 男     |
|  4 | 李网   | 女     |
|  6 | 章节   | 男     |
+----+--------+--------+
5 rows in set (0.00 sec)
二、SQL语句
1、新增

1. insert into库名称.表名

        (id,username,password)values(1,"abc","123")

2. insert into 表名称 values(1, "name","word")

3. insert into 表名称 select* from 其他表

4. insert into 表 values (),()

2、删除

1. delete from 表名

2. deletefrom表名称 where id=3

3. delete from 表名称 where age>8

4. delete from 表 where name on ("a","b","c")

3、修改

 1. update mysql.user set host='%' where name='root'

 2. update user set password='abc' where username="zhangsan"

4、查询
        1. 单表查询

1.1 select 字段名列表 from表名称,索引

1.2

5、远程连接数据库的

username

password

url (mysql IP或者域名 数据库名称 端口号 )

mysql> create user 'li'@'%' identified by '123';
Query OK, 0 rows affected (0.02 sec)mysql> grant all on *.* to 'li'@'%';
Query OK, 0 rows affected (0.01 sec)mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)mysql> select count(*) from student;
+----------+
| count(*) |
+----------+
|        4 |
+----------+
1 row in set (0.06 sec)mysql> select count(1) from student;
+----------+
| count(1) |
+----------+
|        4 |
+----------+
1 row in set (0.06 sec)mysql> select a.*,b.* from student as a,student as b;
+----+--------+--------+----+--------+--------+
| id | name   | gender | id | name   | gender |
+----+--------+--------+----+--------+--------+
|  6 | 章节   | 男     |  1 | 张三   | 男     |
|  3 | 张三   | 男     |  1 | 张三   | 男     |
|  2 | 凤凰   | 女     |  1 | 张三   | 男     |
|  1 | 张三   | 男     |  1 | 张三   | 男     |
|  6 | 章节   | 男     |  2 | 凤凰   | 女     |
|  3 | 张三   | 男     |  2 | 凤凰   | 女     |
|  2 | 凤凰   | 女     |  2 | 凤凰   | 女     |
|  1 | 张三   | 男     |  2 | 凤凰   | 女     |
|  6 | 章节   | 男     |  3 | 张三   | 男     |
|  3 | 张三   | 男     |  3 | 张三   | 男     |
|  2 | 凤凰   | 女     |  3 | 张三   | 男     |
|  1 | 张三   | 男     |  3 | 张三   | 男     |
|  6 | 章节   | 男     |  6 | 章节   | 男     |
|  3 | 张三   | 男     |  6 | 章节   | 男     |
|  2 | 凤凰   | 女     |  6 | 章节   | 男     |
|  1 | 张三   | 男     |  6 | 章节   | 男     |
+----+--------+--------+----+--------+--------+#别名
mysql> select id as 编号,name,gender from student;
+--------+--------+--------+
| 编号   | name   | gender |
+--------+--------+--------+
|      1 | 张三   | 男     |
|      2 | 凤凰   | 女     |
|      3 | 张三   | 男     |
|      6 | 章节   | 男     |
+--------+--------+--------+
6、mysql函数

排序:max min

汇总:count sum avg

数制:二进制 八进制 十进制 十六进制

只有select子句和having子句,order by 子句中能使用聚合函数1,where子句红中不能使用聚合函数,当使用聚合函数查询以后,不能使用where条件,如果添加条件 ,就使用having

mysql> select * from student order by gender desc;
+----+--------+--------+
| id | name   | gender |
+----+--------+--------+
|  1 | 张三   | 男     |
|  3 | 张三   | 男     |
|  6 | 章节   | 男     |
|  2 | 凤凰   | 女     |
+----+--------+--------+
4 rows in set (0.00 sec)mysql> select * from student order by gender asc;
+----+--------+--------+
| id | name   | gender |
+----+--------+--------+
|  2 | 凤凰   | 女     |
|  1 | 张三   | 男     |
|  3 | 张三   | 男     |
|  6 | 章节   | 男     |
+----+--------+--------+
4 rows in set (0.00 sec)mysql> select gender as 性别,count(gender) as 人数 from student grroup by gender;
+--------+--------+
| 性别   | 人数   |
+--------+--------+
| 男     |      3 |
| 女     |      1 |
+--------+--------+
2 rows in set (0.00 sec)mysql> create table product(-> id int primary key auto_increment,-> name varchar(45) not null,-> price float not null,-> qty int not null);
Query OK, 0 rows affected (0.01 sec)mysql> desc product;
+-------+-------------+------+-----+---------+----------------+
| Field | Type        | Null | Key | Default | Extra          |
+-------+-------------+------+-----+---------+----------------+
| id    | int         | NO   | PRI | NULL    | auto_increment |
| name  | varchar(45) | NO   |     | NULL    |                |
| price | float       | NO   |     | NULL    |                |
| qty   | int         | NO   |     | NULL    |                |
+-------+-------------+------+-----+---------+----------------+
4 rows in set (0.01 sec)mysql> insert into product (name,price,qty) values("香蕉",8.5,200);
Query OK, 1 row affected (0.00 sec)mysql> insert into product (name,price,qty) values("苹果",12.5,40)0);
Query OK, 1 row affected (0.00 sec)mysql> insert into product (name,price,qty) values("菠萝",12.4,700);
Query OK, 1 row affected (0.01 sec)mysql> insert into product (name,price,qty) values("哈密瓜",18.3,7400);
Query OK, 1 row affected (0.00 sec)mysql> select * from product order by price;
+----+-----------+-------+-----+
| id | name      | price | qty |
+----+-----------+-------+-----+
|  1 | 香蕉      |   8.5 | 200 |
|  3 | 菠萝      |  12.4 |  70 |
|  2 | 苹果      |  12.5 | 400 |
|  4 | 哈密瓜    |  18.3 | 400 |
+----+-----------+-------+-----+mysql> select * from (select * from product order by qty) as a ordder by a.price;
+----+-----------+-------+-----+
| id | name      | price | qty |
+----+-----------+-------+-----+
|  1 | 香蕉      |   8.5 | 200 |
|  3 | 菠萝      |  12.4 |  70 |
|  2 | 苹果      |  12.5 | 400 |
|  4 | 哈密瓜    |  18.3 | 400 |
+----+-----------+-------+-----+
4 rows in set (0.00 sec)mysql> select max(price) from product;
+------------+
| max(price) |
+------------+
|       18.3 |
+------------+
1 row in set (0.00 sec)mysql> select min(price) from product;
+------------+
| min(price) |
+------------+
|        8.5 |
+------------+
1 row in set (0.00 sec)mysql> select sum(price) from product;
+-------------------+
| sum(price)        |
+-------------------+
| 51.69999885559082 |
+-------------------+
1 row in set (0.01 sec)

相关文章:

2024年8月7日(mysql主从 )

回顾 主服务器 [rootmaster_mysql ~]# yum -y install rsync [rootmaster_mysql ~]# tar -xf mysql-8.0.33-linux-glibc2.12-x86_64.tar [rootmaster_mysql ~]# tar -xf mysql-8.0.33-linux-glibc2.12-x86_64.tar.xz [rootmaster_mysql ~]# cp -r mysql-8.0.33-linux-glibc2.…...

接口/自动化测试 面试集合

1. apache和nginx的区别? Nginx相对Apache的优点: 轻量级,同样起web服务,比apache占用更少的内存及资源; 抗并发,nginx处理请求是异步非阻塞的,支持更多的并发连接,而apache则是阻塞型的,在高 并发下ngi…...

菜鸡勇闯第136场双周赛

菜鸡鼓足了勇气报名了力扣双周赛(后来复盘才知道双周赛更难一点,我真是头铁。。) 没想到还拿了个竞赛名次哈哈哈哈哈还在前50%,小力它真的,我哭死 为什么我本科被高数老师忽悠,去打了两年数模o(≧口≦)o 每…...

趋动科技陈飞:从小模型到大模型,AI时代下的数据中心建设

自AI大模型横空出世,不断推动着AI从学术界到产业界向大众破圈,新的时代正在来临。11月15-16日,由CDCC主办的“2023第11届数据中心标准大会”在北京国家会议中心盛大开幕。 本届大会的主题围绕“AI时代 重塑未来”,聚焦数据中心领…...

yolo v8 + flask部署到云服务器,以及问题记录

环境安装 1、运行项目报错:no python application found, check your startup logs for errors 在云服务器pytorch版本安装错了,安装了GPU版本,需要安装CPU版本 # CPU only 使用下面这段代码避免出现第二个错误 pip install torch2.3.1 to…...

【科研必备插件】easyscholar如何使文章显示期刊影响因子与分区等级

简要介绍 EasyScholar 是一个微软 Edge 浏览器的扩展程序,可以显示会议、期刊等级。可支持在各大论文搜索网站,显示各种期刊、会议等级排名 要想你的知网页面如下图所示,快来获取安装,快速科研有方法 插件安装教程 ①打开浏览器…...

UE5 UrlEncode转换

调用接口时用到了 UFUNCTION(BlueprintPure, Category "FuncLib", meta (Keywords "URL1"))static FString StringToURLEncode(const FString& str1);FString UBasicFuncLib::StringToURLEncode(const FString& str1){return FGenericPlatformH…...

【QML】Qt.rgba()的正确使用方法

1. 问题 设置颜色 color: Qt.rgba(65,105,225,255) ,应该是蓝色,却显示白色。 2. 正确方法 //正确代码 color: Qt.rgba(65/255, 105/255, 225/255, 255/255)...

centos7.9 docker安装

1、不要通过yum直接安装 具体原因: CentOS 6 因内核太旧,即使支持安装 docker,但会有各种问题,不建议安装CentOS 7 的 extras 源虽然可以安装 docker,但包比较旧,建议从官方源或镜像源站点下载安装 docke…...

spring操作数据库

xml版 程序结构 配置文件 dbUtil-阿帕奇提供操作数据库的插件 核心类&#xff1a;QueryRunner .query() 查询 .update() 增删改 <dependencies><!-- spring --><dependency><groupId>org.springframework</groupId><artifactId>spri…...

Apache Flink中TaskManager,SubTask,TaskSlot,并行度之间的关系

Apache Flink 中Application 与 Job 一个完整的Flink Application 一般组成如下&#xff1a; Source 数据来源Transformation 数据转换处理等Sink 数据传输 Flink 中一个或者多个Operator&#xff08;算子&#xff09;组合对数据进行转换形成一个 Transformation&#xff0c;一…...

马斯克xAI新计划:人工智能模型Grok 2测试版即将发布

特斯拉CEO马斯克在X平台上表示&#xff0c;人工智能模型Grok 2测试版即将发布。Grok&#xff0c;作为xAI公司的明星大语言模型&#xff0c;其首代产品Grok 1已凭借神经演化计算与深度学习技术的深度融合&#xff0c;展现了超乎想象的学习速度与智能深度&#xff0c;赢得了业界的…...

【机器人学】6-4.六自由度机器人运动学参数辨识-机器人精度验证【附MATLAB代码】

前言 前两个章节以及完成了机器人参数辨识。 【机器人学】6-1.六自由度机器人运动学参数辨识-辨识数学模型的建立 【机器人学】6-2.六自由度机器人运动学参数辨识-优化方法求解辨识参数 这里我们认为激光测量仪测量到的数据为机器人实际到达的位置&#xff0c;而机器人理论到…...

分销商城小程序系统渠道拓展

线上卖货渠道很多&#xff0c;想要不断提高营收和新客获取&#xff0c;除了自己和工具本身努力外&#xff0c;还需要其他人的帮助来提高商城店铺的整体销量。 搭建saas商城系统网站/小程序&#xff0c;后台上货&#xff0c;设置支付、配送、营销、精美模板商城装修等内容&…...

WPF篇(14)-ProgressBar进度条+Calendar日历控件+DatePicker日期控件

ProgressBar进度条 ProgressBar进度条通常在我们执行某个任务需要花费大量时间时使用&#xff0c;这时可以采用进度条显示任务或线程的执行进度&#xff0c;以便给用户良好的使用体验。 ProgressBar类定义 public class ProgressBar : RangeBase {public static readonly De…...

链表高频题目和必备技巧

链表高频题目和必备技巧 1. 链表类题目注意点 1&#xff0c;如果笔试中空间要求不严格&#xff0c;直接使用容器来解决链表问题 2&#xff0c;如果笔试中空间要求严格、或者在面试中面试官强调空间的优化&#xff0c;需要使用额外空间复杂度**O(1)**的方法 3&#xff0c;最…...

Vue3详细介绍,正则采集器所用前端框架

Vue3 引入了一个全新的响应式系统&#xff0c;它是基于ES6的Proxy特性构建的。这个系统使得 Vue 能够更加高效地追踪数据的变化&#xff0c;并在数据发生变化时自动更新DOM。响应式系统的核心是"可观察"&#xff0c;当数据变化时&#xff0c;视图会响应这些变化并重新…...

数据集--COCO2017(快速下载)

1、数据集介绍 数据集官网&#xff1a;https://cocodataset.org/#home COCO&#xff08;Common Objects in Context&#xff09;数据集是计算机视觉领域中最广泛使用的数据集之一&#xff0c;主要用于目标检测、分割和图像标注任务。COCO 数据集由 Microsoft 发布&#xff0c…...

【管理咨询宝藏159】顶级咨询公司人力三支柱建设方案思路

阅读完整版报告内容&#xff0c;请搜索VV号“管理咨询宝藏”。 【管理咨询宝藏159】顶级咨询公司人力三支柱建设方案思路 【格式】PDF版本 【关键词】人力咨询、三支柱、人力体系 【核心观点】 - 集团总部制定全集团共享中心总体规划路径&#xff0c;组织并负责实施与推广。各…...

跨时钟域总结

跨时钟域总结 秋招学习跨时钟域 总结一下吧 异步电路 设计中有两个频率不同的时钟(也可能多个),而有数据在两组时钟之间传输 单bit跨时钟域 慢时钟域数据-> 快时钟域 方法 : 使用两个锁存器 (打两拍) 数据跨时钟域同步过程中,脉冲宽度会改变&#xff0c;不影响同步结…...

Android Wi-Fi 连接失败日志分析

1. Android wifi 关键日志总结 (1) Wi-Fi 断开 (CTRL-EVENT-DISCONNECTED reason3) 日志相关部分&#xff1a; 06-05 10:48:40.987 943 943 I wpa_supplicant: wlan0: CTRL-EVENT-DISCONNECTED bssid44:9b:c1:57:a8:90 reason3 locally_generated1解析&#xff1a; CTR…...

C++_核心编程_多态案例二-制作饮品

#include <iostream> #include <string> using namespace std;/*制作饮品的大致流程为&#xff1a;煮水 - 冲泡 - 倒入杯中 - 加入辅料 利用多态技术实现本案例&#xff0c;提供抽象制作饮品基类&#xff0c;提供子类制作咖啡和茶叶*//*基类*/ class AbstractDr…...

【磁盘】每天掌握一个Linux命令 - iostat

目录 【磁盘】每天掌握一个Linux命令 - iostat工具概述安装方式核心功能基础用法进阶操作实战案例面试题场景生产场景 注意事项 【磁盘】每天掌握一个Linux命令 - iostat 工具概述 iostat&#xff08;I/O Statistics&#xff09;是Linux系统下用于监视系统输入输出设备和CPU使…...

智能在线客服平台:数字化时代企业连接用户的 AI 中枢

随着互联网技术的飞速发展&#xff0c;消费者期望能够随时随地与企业进行交流。在线客服平台作为连接企业与客户的重要桥梁&#xff0c;不仅优化了客户体验&#xff0c;还提升了企业的服务效率和市场竞争力。本文将探讨在线客服平台的重要性、技术进展、实际应用&#xff0c;并…...

【论文笔记】若干矿井粉尘检测算法概述

总的来说&#xff0c;传统机器学习、传统机器学习与深度学习的结合、LSTM等算法所需要的数据集来源于矿井传感器测量的粉尘浓度&#xff0c;通过建立回归模型来预测未来矿井的粉尘浓度。传统机器学习算法性能易受数据中极端值的影响。YOLO等计算机视觉算法所需要的数据集来源于…...

鸿蒙中用HarmonyOS SDK应用服务 HarmonyOS5开发一个医院查看报告小程序

一、开发环境准备 ​​工具安装​​&#xff1a; 下载安装DevEco Studio 4.0&#xff08;支持HarmonyOS 5&#xff09;配置HarmonyOS SDK 5.0确保Node.js版本≥14 ​​项目初始化​​&#xff1a; ohpm init harmony/hospital-report-app 二、核心功能模块实现 1. 报告列表…...

让AI看见世界:MCP协议与服务器的工作原理

让AI看见世界&#xff1a;MCP协议与服务器的工作原理 MCP&#xff08;Model Context Protocol&#xff09;是一种创新的通信协议&#xff0c;旨在让大型语言模型能够安全、高效地与外部资源进行交互。在AI技术快速发展的今天&#xff0c;MCP正成为连接AI与现实世界的重要桥梁。…...

网络编程(UDP编程)

思维导图 UDP基础编程&#xff08;单播&#xff09; 1.流程图 服务器&#xff1a;短信的接收方 创建套接字 (socket)-----------------------------------------》有手机指定网络信息-----------------------------------------------》有号码绑定套接字 (bind)--------------…...

算法笔记2

1.字符串拼接最好用StringBuilder&#xff0c;不用String 2.创建List<>类型的数组并创建内存 List arr[] new ArrayList[26]; Arrays.setAll(arr, i -> new ArrayList<>()); 3.去掉首尾空格...

深入浅出深度学习基础:从感知机到全连接神经网络的核心原理与应用

文章目录 前言一、感知机 (Perceptron)1.1 基础介绍1.1.1 感知机是什么&#xff1f;1.1.2 感知机的工作原理 1.2 感知机的简单应用&#xff1a;基本逻辑门1.2.1 逻辑与 (Logic AND)1.2.2 逻辑或 (Logic OR)1.2.3 逻辑与非 (Logic NAND) 1.3 感知机的实现1.3.1 简单实现 (基于阈…...