Please use zip package to install MySQL instead of MSI!!!
It is obviously easy to install MySQL in windows. Why do I feel so bad?
The reason is that the first time you install it successfully, and the second time you install it again, there will be some strange things. The online tutorial will let you delete all kinds of registries. Is it hard
The source of this pitfall is that you used the MSI package of Mysql to install it. This is the following. Anyway, I have installed it for many times without success, so I used the MySQL image of the docker on the ECS before
Moreover, installing MySQL on MSI will be installed on Disk C by default. I am unable to roast
WeMust useZip package installation method:MySQL installation package
After downloading, I unzip it here to: d:\java\mysql
Enter the mysql-5.7.33-winx64 directory, create the following two directories (note that you should set your file to show hidden suffixes), and put data into our new tables and system tables, my Ini is the MySQL configuration file. You can configure ports, absolute paths of data directories, etc
My The. INI file is as follows. What we need to change is basedir and dataDir
[client] port=3306 default-character-set=utf8 [mysqld] #Set as your own MySQL installation directory basedir=D:\\java\MySQL\\mysql-5.7.33-winx64 #Set to MySQL data directory datadir=D:\\java\\MySQL\\mysql-5.7.33-winx64\\data port=3306 character_set_server=utf8 sql_mode=NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER #Enable query cache explicit_defaults_for_timestamp=true #With this configuration, you can log in with any user name and password, even if it doesn't exist skip-grant-tables
Configure environment variables and add them to the path
Here is the key!!!
1. open CMD in administrator mode
2. CMD switch to the bin directory of MySQL, that is, the directory where the environment variables are configured above
3 Generation service: mysqld install
4 Start MySQL service: Net start MySQL
5. (optional) if you want to delete the MySQL service just generated:mysqld -remove
6. (optional) if you want to check whether the generated service has been started, you can win+r, open the run, and enter services MSC can see all services
7. if there is no problem, you can use it: MySQL -uroot -p123456. The user name and password here can be written at will