当前位置:网站首页>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
边栏推荐
- 微软 AI 量化投资平台 Qlib 体验
- SOLVED: After accidentally uninstalling pip (two ways to manually install pip)
- MySQL数据库必会的增删查改操作(CRUD)
- Why don't you programmers make a living off your own projects?And have to work for someone else?
- ClickHouse:设置远程连接
- volatile内存语义以及实现 -volatile写和读对普通变量的影响
- 论治理与创新 | 2022开放原子全球开源峰会OpenAnolis分论坛圆满召开
- [Paper reading] Mastering the game of Go with deep neural networks and tree search
- ClickHouse: Setting up remote connections
- XSS shooting range (3) prompt to win
猜你喜欢

C language confession code?

开放原子开源基金会秘书长孙文龙 | 凝心聚力,共拓开源

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

Unity URP渲染管线摄像机核心机制剖析

(四)递归、可变参数、访问修饰符、理解 main 方法、代码块

Industry-university-research application to build an open source talent ecosystem | 2022 Open Atom Global Open Source Summit Education Sub-Forum was successfully held

从零开始,一镜到底,纯净系统搭建除草机(Grasscutter)
![[C language] General method of base conversion](/img/28/954af5f47a79ff02d3cc0792ac8586.jpg)
[C language] General method of base conversion

The idea project obviously has dependencies, but the file is not displayed, Cannot resolve symbol 'XXX'

binom二项分布,
随机推荐
unity2d game
【云原生】DevOps(五):集成Harbor
Vue项目通过node连接MySQL数据库并实现增删改查操作
IDEA common shortcut keys and plug-ins
MySQL数据库必会的增删查改操作(CRUD)
MySQL fuzzy query can use INSTR instead of LIKE
Safety 20220715
PCL 计算点云坐标最值及其索引
Understanding of the presence of a large number of close_wait states
MySQL 8.0.30 GA
HCIP Day 10_BGP Route Summary Experiment
ERROR 1064 (42000) You have an error in your SQL syntax; check the manual that corresponds to your
VScode+ESP32快速安装ESP-IDF插件
Learning DAVID Database (1)
MySQL数据库备份
[AUTOSAR-RTE]-5-Explicit (explicit) and Implicit (implicit) Sender-Receiver communication
手把手实现图片预览插件(三)
three.js make 3D photo album
Visual studio shortcuts that improve efficiency, summary (updated from time to time)
Error EPERM operation not permitted, mkdir ‘Dsoftwarenodejsnode_cache_cacach两种解决办法