当前位置:网站首页>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-30 17:12:00 【Programmer over time】
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 to successfully create, and 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 when I see 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 Shanghai Jiaotong University in 2013. I worked in a small company and went to big factories such as Huawei and OPPO. I joined Alibaba 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 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
边栏推荐
- MySql统计函数COUNT详解
- 每日练习------生成13位条形, Ean-13码规则:第十三位数字是前十二位数字经过计算得到的校验码。
- KDD 2020 | 深入浅出优势特征蒸馏在淘宝推荐中的应用
- PHP message feedback management system source code
- data storage
- Mysql进阶优化篇01——四万字详解数据库性能分析工具(深入、全面、详细,收藏备用)
- How does the new retail saas applet explore the way to break the digital store?
- SYSCALL SWAPGS
- 第5章 SQL高级处理
- 实现web实时消息推送的7种方案
猜你喜欢
随机推荐
基于stm32的shell实现
中文字符集编码Unicode ,gb2312 , cp936 ,GBK,GB18030
Is it reliable to work full-time in self-media?
MySQL 8.0.29 解压版安装教程(亲测有效)
Daily practice------Generate 13-digit bar, Ean-13 code rule: The thirteenth digit is the check code obtained by the calculation of the first twelve digits.
huato hot update environment construction (DLL method hot update C# code)
S7-200SMART中定时器的使用方法和常见注意事项汇总
每日练习------生成13位条形, Ean-13码规则:第十三位数字是前十二位数字经过计算得到的校验码。
FP6606ACAW4 TQFN-20L (3mmx3mm) USB双端口充电控制器 百盛电子代理
MySQL索引常见面试题(2022版)
全职做自媒体靠谱吗?
【云商店公告】关于7月30日帮助中心更新通知
lotus 爆块失败
Test Management and Specification
华为云数据治理生产线DataArts,让“数据‘慧’说话”
镜像站收集
The first time I used debug query and found that this was empty, does it mean that the database has not been obtained yet?please help.
BCryptPasswordEncoder的使用及原理
C语言向MySQL插入数据
DTSE Tech Talk丨Phase 2: 1 hour in-depth interpretation of SaaS application system design








![[HarekazeCTF2019]Avatar Uploader 1](/img/2c/6dde7b8d34ba0deb334b4283e1e30e.png)
