当前位置:网站首页>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-31 04:44:00 【sebeefe】
This solution was prepared by me according to a series of methods on the Internet and suddenly succeeded, so I think it may be caused by its own instability
First of all, I downloaded the mysql file on the official website, and I can find how to download it anywhere on the Internet
After opening the file, I found that there is no my.ini

So I found a document and put it in there
[mysqld]# set port 3306port=3306# Set the installation directory of mysql ------- is your file path -------------basedir=F:mysql-8.0.27-winx64# Set the storage directory of the data of the mysql database --------- is your file path data folder created by yourself#datadir=F:mysql-8.0.27-winx64data# maximum number of connections allowedmax_connections=200# Allow connection failures.max_connect_errors=10# The character set used by the server defaults to utf8mb4character-set-server=utf8mb4# The default storage engine that will be used when creating new tablesdefault-storage-engine=INNODB# By default, the "mysql_native_password" plugin is used for authentication#mysql_native_passworddefault_authentication_plugin=mysql_native_password[mysql]# Set the default character set of the mysql clientdefault-character-set=utf8mb4[client]# Set the default port used by the mysql client to connect to the serverport=3306default-character-set=utf8mb4Be careful not to copy, the file path is the path you downloaded yourself, and the data will be automatically generated when it is created, so just write the path, don't create it yourself, and don't change the name in the path, just call it data
p>The next step is to initialize the My SQL database
Switch to the bin directory, I opened it directly as an administrator

Copy the following code in the MySQLbin directory
mysqld --initialize --console

If this happens to me, it means that the data has been created. If the data is deleted, it can run normally again. If the data cannot be deleted, you need to hold down win+r and then enter services.msc, press Enter to find mysql

Then close it, you can delete the data
If the run is successful, you will see a [email protected]: in the note on the last line...The latter is a random initial password, write it down
Enter after
net start mysql
It will appear that the service is starting and the service is successful
Enter later
mysql -uroot -p
Enter will ask you to enter the password, this is where I start 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)
The whole self-closing, the operation is done step by step, why is there a problem (although there were some small problems before, but I have reminded everyone of the configuration method I mentioned above) Then I started to find a way to findI couldn't find the reason for a morning, so I repeated the above operation, deleted the data, then restarted mysql in services.msc, and then entered net start mysql in the command prompt to restart the service, I found that it seems thatIn services, mysql is not started immediately. After entering net start mysql, it takes a while for mysql to start. When mysql starts, I enter mysql -uroot -p again, and enter a random password, and it suddenly succeeds

I think it may be that mysql does not start immediately after being prompted in the command prompt for successful creation. You need to wait for the complete startup before you can enter the password and then enter
Change password
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password you want to change';
Finally, I hope everyone can succeed once, and it crashes after seeing n times of ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost:3306' (10061)
Let me introduce myself first. The editor graduated from Jiaotong University in 2013. I worked in a small company and went to big factories such as Huawei and OPPO. I joined Ali in 2018, until now.I know that most junior and intermediate java engineers want to upgrade their skills, they often need to explore their own growth or sign up to study, but for training institutions, the tuition fee is nearly 10,000 yuan, which is really stressful.Self-learning that is not systematic is very inefficient and lengthy, and it is easy to hit the ceiling and the technology stops.Therefore, I collected a "full set of learning materials for java development" for everyone. The original intention is also very simple. I hope to help friends who want to learn by themselves but don't know where to start, and at the same time reduce everyone's burden.Add the business card below to get a full set of learning materials
边栏推荐
- BUG消灭者!!实用调试技巧超全整理
- [shell basics] determine whether the directory is empty
- prompt.ml/15中<svg>标签使用解释
- WPF WPF 】 【 the depth resolution of the template
- Fusion Cloud Native, Empowering New Milestones | 2022 Open Atom Global Open Source Summit Cloud Native Sub-Forum Successfully Held
- 强化学习:从入门到入坑再到拉屎
- (八)Math 类、Arrays 类、System类、Biglnteger 和 BigDecimal 类、日期类
- three.js 制作3D相册
- 【wpf】wpf中的那些模板之深度解析
- C language from entry to such as soil, the data store
猜你喜欢

The third is the code to achieve

递归实现汉诺塔问题

ERROR 2003 (HY000) Can‘t connect to MySQL server on ‘localhost3306‘ (10061)解决办法

从零开始,一镜到底,纯净系统搭建除草机(Grasscutter)

产学研用 共建开源人才生态 | 2022开放原子全球开源峰会教育分论坛圆满召开

【debug锦集】Expected input batch_size (1) to match target batch_size (0)

【线性神经网络】softmax回归

WPF WPF 】 【 the depth resolution of the template

MySQL based operations

STM32HAL library modifies Hal_Delay to us-level delay
随机推荐
MySQL fuzzy query can use INSTR instead of LIKE
两个地址池r2负责管地址池r1负责管dhcp中继
Bubble sort, selection sort, insertion sort, binary search directly
Recursive implementation of the Tower of Hanoi problem
(五)final、抽象类、接口、内部类
Understanding of the presence of a large number of close_wait states
Industry-university-research application to build an open source talent ecosystem | 2022 Open Atom Global Open Source Summit Education Sub-Forum was successfully held
C Implementation of Simple Network File Copy
unity2d小游戏
Win10 CUDA CUDNN installation configuration (torch paddlepaddle)
XSS靶场(三)prompt to win
"DeepJIT: An End-To-End Deep Learning Framework for Just-In-Time Defect Prediction" paper notes
产学研用 共建开源人才生态 | 2022开放原子全球开源峰会教育分论坛圆满召开
el-image标签绑定点击事件后没有有用
从零开始,一镜到底,纯净系统搭建除草机(Grasscutter)
MySQL修改root账号密码
VScode+ESP32 quickly install ESP-IDF plugin
【线性神经网络】softmax回归
Reinforcement learning: from entry to pit to shit
BUG destroyer!!Practical debugging skills are super comprehensive