当前位置:网站首页>Error 2003 (HY000) can't connect to MySQL server on 'localhost3306' (10061) solution
Error 2003 (HY000) can't connect to MySQL server on 'localhost3306' (10061) solution
2022-07-28 18:39:00 【m0_ sixty-seven million three hundred and ninety-four thousand 】
This solution is based on a series of online methods to prepare for sudden success , So I think it may be caused by its instability
First , I downloaded it on the official website mysql file , You can find how to download it on the Internet
Then after opening the file , Found no my.ini

So I found a document and put it in
[mysqld]
# Set up 3306 port
port=3306
# Set up mysql Installation directory ---------- Is your file path -------------
basedir=F:mysql-8.0.27-winx64
# Set up mysql Database data storage directory --------- Is your file path data The folder is created by itself
#datadir=F:mysql-8.0.27-winx64data
# Maximum connections allowed
max_connections=200
# Number of connection failures allowed .
max_connect_errors=10
# The character set used by the server defaults to utf8mb4
character-set-server=utf8mb4
# The default storage engine that will be used when creating a new table
default-storage-engine=INNODB
# By default “mysql_native_password” Plug in authentication
#mysql_native_password
default_authentication_plugin=mysql_native_password
[mysql]
# Set up mysql Client default character set
default-character-set=utf8mb4
[client]
# Set up mysql The default port when the client connects to the server
port=3306
default-character-set=utf8mb4
Be careful not to copy , The file path is your own download path ,data It will be generated automatically when it is created , So just write the path , Don't create it yourself , Don't change your name in the path , Call data
Then it's initialization My SQL database
Switch to bin Under the table of contents , I opened it directly as an administrator

stay MySQLbin Copy the following code under the directory
mysqld --initialize --console

If this happens to me, it means data It has been created , Deleted data It can run normally again , If data If you can't delete it, you need to press and hold win+r Then input services.msc, Enter to find mysql

Then close it , You can delete data 了
If it runs successfully , It will be on the last line note I saw one in the r[email protected]:... The following is the random initial password , Write him down
After input
net start mysql
The service is starting and the service is successful
Then type
mysql -uroot -p
Enter and you will be asked to enter the password , This is where I began to have a headache , Every time I enter the password, it will appear
ERROR 2003 (HY000): Can’t connect to MySQL server on ‘localhost:3306’ (10061)
It's completely autistic , The operation is step by step. Why do problems occur ( Although there were some small problems before , However, the configuration method I mentioned above has reminded you ) Then I began to find a way , I've been looking for a whole morning, but I haven't found the reason , So I repeat the above operation , take data Deleted , And then restart in services.msc Restart in mysql, Then enter... At the command prompt net start mysql Restart the service , I find it seems to be services in ,mysql It is not started immediately , Input net start mysql After that, I need to wait for a while ,mysql Will start , etc. mysql Launched the , I'll type it again mysql -uroot -p, Enter the random password and suddenly succeed

I think it may be after the prompt of successful creation in the command prompt ,mysql It didn't start immediately , You can enter the password and then enter after the successful startup
Change Password
ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘ The password you want to change ’;
Finally, I hope everyone can succeed at once , notice n many times ERROR 2003 (HY000): Can’t connect to MySQL server on ‘localhost:3306’ (10061) It's quite collapsed 
边栏推荐
猜你喜欢

DC-DC switching power supply

npm 无法将“npm”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。

Multithreading and high concurrency -- source code analysis AQS principle

多线程与高并发—— 源码解析 AQS 原理

频谱仪原理简介二

Brief introduction to the principle of spectrometer I

GIS数据漫谈(六)— 投影坐标系统

Introduction to advanced design system (ads) 2009 RF simulation

记录自己在厦门两年来的面试经历--完结篇

Six countries in Europe and the United States launched an express line product to optimize the "end-to-end" performance service on the 5th
随机推荐
The required error of solidity is reported
MongoDB数据库shell命令执行
WordPress prompt error in establishing database connection
Go的walk库报错
高德地图实现自定义小蓝点 自定义点标记 绘制多边形/圆形区域 根据地图的移动显示或者隐藏自定义点标记的相关实现
有一种密码学专用语言叫做ASN.1
Implementation of solid transfer function (based on transfer)
How does Xiaobai learn software testing with zero foundation?
Go并发详解之一
Iptables firewall port rule configuration
腾讯汤道生:开源是产业互联网时代新的生产方式和协作模式
顿悟!百度强推的Redis天花板笔记,原来数据库是这样理解的
初识结构体
Principle, classification and requirements of antenna
UE5 GAS 学习笔记 1.8 游戏特效(GameplayCue)
Go的sleep
Examples of AC simulation and S-parameter simulation of ADS simulation
Detailed explanation of oscilloscope probe
Golang 并发之锁
Random talk on GIS data (VI) - projection coordinate system