diff --git a/source/_posts/MySQL.md b/source/_posts/MySQL.md index 59de64c..23d4748 100644 --- a/source/_posts/MySQL.md +++ b/source/_posts/MySQL.md @@ -45,3 +45,114 @@ mysqldump -uroot -p test --no-data > test.sql mysqldump -uroot -p -B test > test.sql ``` +## Windows 下安装 绿色版 + +先下载[MySQL :: Download MySQL Community Server](https://dev.mysql.com/downloads/mysql/) + +![image-20231007124717167](https://markdownhexo.oss-cn-hangzhou.aliyuncs.com/img/image-20231007124717167.png) + +1. 解压下载好的压缩包 + ![在这里插入图片描述](https://img-blog.csdnimg.cn/20210120105901505.png#pic_left) + +2. 解压后得到 + ![在这里插入图片描述](https://img-blog.csdnimg.cn/20210120105247435.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0NXZVFpbg==,size_16,color_FFFFFF,t_70#pic_center) + +3. 新建一个 `my.ini`文件 + ![在这里插入图片描述](https://img-blog.csdnimg.cn/20210120110525427.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0NXZVFpbg==,size_16,color_FFFFFF,t_70#pic_center) + +4. 解压后的mysql根目录下没有my.ini文件,自己去网上找一份就可或者使用我在后面给出的代码。.ini文件会在初始化mysql中用到 + ```ini + # For advice on how to change settings please see + # http=//dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html + # *** DO NOT EDIT THIS FILE. It's a template which will be copied to the + # *** default location during install, and will be replaced if you + # *** upgrade to a newer version of MySQL. + + [client] + port = 3306 + default-character-set = utf8 + + [mysqld] + + # Remove leading # and set to the amount of RAM for the most important data + # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. + # innodb_buffer_pool_size = 128M + + # Remove leading # to turn on a very important data integrity option= logging + # changes to the binary log between backups. + # log_bin + port = 3306 + # These are commonly set, remove the # and set as required. + basedir="D:\app\mysql-5.7.43-winx64" + datadir="D:\app\mysql-5.7.43-winx64\data" + # server_id = ..... + character_set_server = utf8 + + # Remove leading # to set options mainly useful for reporting servers. + # The server defaults are faster for transactions and fast SELECTs. + # Adjust sizes as needed, experiment to find the optimal values. + # join_buffer_size = 128M + # sort_buffer_size = 2M + # read_rnd_buffer_size = 2M + + sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES + + ``` + +5. 修改ini配置文件中的安装目录和数据存放目录修改为mysql文件的路径 + +6. \#设置mysql的安装目录 + basedir=D:\app\mysql-5.7.43-winx64 + \#设置mysql数据库的数据的存放目录 + datadir=D:\app\mysql-5.7.43-winx64\data + +7. 打开cmd,初始化数据库 + ```powershell + mysqld --initialize + ``` + +8. 初始化完成后,mysqld根目录下会自动新增data文件夹 + ![在这里插入图片描述](https://img-blog.csdnimg.cn/20210120153744844.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0NXZVFpbg==,size_16,color_FFFFFF,t_70#pic_center) + +9. 打开data文件夹,找到.err后缀文本打开 + ![在这里插入图片描述](https://img-blog.csdnimg.cn/20210120153933128.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0NXZVFpbg==,size_16,color_FFFFFF,t_70#pic_center) + +10. 找到文件password位置,红色框中为数据库初始化密码,后续修改初始化密码使用 + ```err + 2023-10-07T04:37:02.330654Z 1 [Note] A temporary password is generated for root@localhost: (iw?Mw:Vs7n& + ``` + +11. 安装数据库 + ```powershell + mysqld --install + ``` + +12. 启动服务 + ```powershell + net start mysql + ``` + +13. 关闭服务 + ```powershell + net stop mysql + ``` + +14. 修改初始密码 + + - 登录 + ```powershell + mysql -uroot -p'你的初始密码,步骤4中红框里的字符' + ``` + + - 修改密码为 123456 + ```mysql + ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'; + ``` + +15. 服务卸载 + ```powershell + net stop mysql + mysqld --remove + ``` + + diff --git a/source/_posts/Nginx.md b/source/_posts/Nginx.md index 73c1fe9..888c781 100644 --- a/source/_posts/Nginx.md +++ b/source/_posts/Nginx.md @@ -91,13 +91,18 @@ http { gzip_disable "MSIE [1-6]\."; #配置禁用gzip条件,支持正则。此处表示ie6及以下不启用gzip(因为ie低版本不支持) # 是否在http header中添加Vary: Accept-Encoding,建议开启 gzip_vary on; + # map $http_upgrade $connection_upgrade { + # 如果$http_upgrade的值与default不匹配(通常是指$http_upgrade未设置或未匹配任何其他条件),则将$connection_upgrade设置为upgrade。 # default upgrade; + # 如果$http_upgrade的值为空字符串(''),则将$connection_upgrade设置为close。这意味着Nginx将关闭连接而不是升级。 # '' close; # } map $http_connection $connection_upgrade { + # 如果$http_connection的值匹配正则表达式~*Upgrade(不区分大小写地匹配包含"Upgrade"的值),则将$connection_upgrade设置为$http_connection的值,通常是upgrade。 "~*Upgrade" $http_connection; + # 如果没有匹配的值,将$connection_upgrade设置为keep-alive。这意味着Nginx将保持HTTP连接保持活动状态以进行进一步的请求和响应。 default keep-alive; } server { @@ -182,7 +187,6 @@ http { location /msghub { proxy_pass http://127.0.0.1:50/msgHub; - # Configuration for WebSockets # 配置 Upgrade 头字段,用于支持 WebSocket 协议升级。当客户端请求 WebSocket 协议时,Nginx 会传递 Upgrade 头字段给后端服务器以升级连接协议。 proxy_set_header Upgrade $http_upgrade; # 配置 Connection 头字段,用于支持 WebSocket 连接的升级。当客户端请求 WebSocket 协议时,Nginx 会传递 Connection 头字段给后端服务器以升级连接协议。 @@ -190,18 +194,15 @@ http { # 禁用了代理缓存,这意味着 Nginx 不会缓存代理响应,适用于实时通信场景,如 WebSocket。 proxy_cache off; # 配置了 HTTP 协议版本为 1.1,这是为了支持 WebSocket,因为 WebSocket 是在 HTTP/1.1 之后的协议中实现的。 - # WebSockets were implemented after http/1.0 proxy_http_version 1.1; - # Configuration for ServerSentEvents # 禁用了代理的缓冲功能,这适用于实时通信场景,如 WebSocket 或 Server-Sent Events(SSE),以确保数据立即传递给客户端而不进行缓冲。 proxy_buffering off; - # Configuration for LongPolling or if your KeepAliveInterval is longer than 60 seconds # 配置了代理的读取超时时间为 100 秒,这允许长轮询或者当 Keep-Alive 间隔大于 60 秒时的请求保持连接。 proxy_read_timeout 100s; - # 设置反向代理请求头中的 Host 头字段为客户端请求的 Host 头字段。这样可以将客户端的 Host 头信息传递给后端服务器,确保后端服务器正确处理请求。 + # 设置反向代理请求头中的 Host 头字段为客户端请求的 Host 头字段。这样可以将客户端的 Host 头信息传递给后端服务器,确保后端服务器正确处理请求。 proxy_set_header Host $host; # 设置反向代理请求头中的 X-Forwarded-For 头字段,用于记录客户端的 IP 地址以及之前的代理服务器的 IP 地址。这有助于后端服务器了解请求的来源路径。 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; diff --git a/source/_posts/PowerShell.md b/source/_posts/PowerShell.md new file mode 100644 index 0000000..5bd9963 --- /dev/null +++ b/source/_posts/PowerShell.md @@ -0,0 +1,29 @@ +--- +title: PowerShell +date: 2023-10-07 11:25:08 +tags: +--- + +# 文件 + +## 新建文件 + +```powershell +New-Item <文件名>.<扩展名后缀> +New-Item my.ini +``` + +## 删除文件 + +```powershell +Remove-Item <文件名>.<扩展名后缀> +Remove-Item my.ini +``` + +## 对文件添加内容 + +```powershell +Set-Content <文件名>.<扩展名后缀> -value "<内容>" +Set-Content my.ini -value "" +``` + diff --git a/source/_posts/Redis.md b/source/_posts/Redis.md index 901965f..8ee72e0 100644 --- a/source/_posts/Redis.md +++ b/source/_posts/Redis.md @@ -35,14 +35,21 @@ make install PREFIX=/usr/redis 到redis安装文件夹 +修改监听端口 + +```conf +bind 127.0.0.1 6379 +``` + +修改库的个数 + ```shell # Set the number of databases. The default database is DB 0, you can select # a different one on a per-connection basis using SELECT where # dbid is a number between 0 and 'databases'-1 databases 16 ``` - -修改库的的个数 +修改端口号port ```shell # Accept connections on the specified port, default is 6379 (IANA #815344). @@ -50,7 +57,11 @@ databases 16 port 6379 ``` -修改端口号port +设置密码 + +```conf +requirepass yourpassword +``` # Redis指令 diff --git a/source/_posts/Vue.md b/source/_posts/Vue.md index a3d931c..acd85d3 100644 --- a/source/_posts/Vue.md +++ b/source/_posts/Vue.md @@ -1861,6 +1861,24 @@ yarn | npm install [package]@[version] | yarn add [package]@[version] | 安装指定版本的包 | | npm rebuild | yarn install --force | 重新下载所有包 | +## 快速删除 node_modules + +利用 npm 包 rimraf 快速删除 `node_modules` 文件夹 + +先全局安装 npm 包 + +```shell +npm install rimraf -g +``` + +使用 + +```shell +rimraf node_modules +``` + + + # npx npm大家都知道,是node的包管理器,npx虽然也见过,但似乎较少用过,那npx到底是什么呢?