


1.进入Mysqld
如果已经设置Mysql/Bin环境变量,直接在CMD里输入命令,如果没有设置Mysql环境变量,去Mysql安装目录的Bin文件夹里运行
F:\AppServ\MySQL\bin\mysql.exe -u root -p
其中root是用户名,然后就可以进入Mysql命令行环境了
2.以后的每一句Mysql命令,每次都要以分号;为结束标识,而不是以回车。
3.注意,,每次都需要重启Mysql才可以使设置生效!!
当然了,如果你直接在Mysql安装目录的 my.ini加上设置值,则可以在Mysql启动时加载设置。比如connect_timeout = 120
然后是需要更改什么参数解决这个问题
当WEB服务器负载高的时候,经常会出现这种错误,
原因:
MySQL默认connect_timeout是5秒,超过了这个时间MySQL的server端就会返回“Bad handshake”。
解决办法:
1.大多数时候设置"set global connect_timeout=60;"是可以解决问题的;
我们可以通过执行“SHOWSTATUS LIKE 'aborted%'”,可以观察到 Variable_name Value
Aborted_clients 6
Aborted_connects 15010
觉得是否要增加connect_timeout的时间,"Aborted_connects"将会随着服务端放弃客户端初始连接而增加。如果"Aborted_connects"很大,并且不断增加,就需要增加"connect_timeout".
2.在MySQL的配置文件中[mysqld]添加"skip-name-resolve",减少域名解析的时间
3.部署服务器端的网络要好,至少大于100Mbps/s
4.如果是在调用mysql_query的时候出现的问题,那就需要把"net_read_timeout"的时间调成30秒,或者60秒,或者更大的值
5.如果还不能解决问题,那估计是你的SQL语句中含有BLOB这种大类型,我们就需要增加"max_allowed_packet"的值了

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 English version
Recommended: Win version, supports code prompts!

SublimeText3 Mac version
God-level code editing software (SublimeText3)
