win10 mysql installation

1. Download

https://dev.mysql.com/downloads/mysql/

ERROR 2003 (HY000): Can't connect to MySQL server on'localhost:3306' (10061)

mysql service always stops automatically

It may be a version issue, change to 5.7

1. Unzip and copy to the location you want to store, such as:

D:\Program Files\mysql-5.7.34-winx64

2. Create a new folder data in this directory. If there is already a data file, clear all files in the data directory.

3. Create a new file my.ini in this directory

[mysqld]basedir=D:\Program Files\mysql-5.7.34-winx64datadir=D:\Program Files\mysql-5.7.34-winx64\data

4. Configure environment variables

5. Start cmd as an administrator and switch to the bin directory of the mysql installation directory

D:\Program Files\mysql-5.7.34-winx64\bin

2. If the mysql version has been installed before, remove the original mysql service first

mysqld --remove mysql

3. Registration service:

mysqld -install

5. Start initialization

mysqld --initialize

6. The login password will be initialized during the initialization process. You can find the file ending with .err in the data file and open it

7. Start mysql, it will show successful startup

net start mysql

8. Use root to log in to mysql

mysql -uroot -p

Prompt for access code, enter the code described in 6

Can't connect to MySQL server on xxx (10061)

9. Modify the root password

set password for [email protected] = password('1234'); 

10. Refresh

FLUSH PRIVILEGES;