This problem has troubled me for a day, and
finally solved today,
step by step
1. Search service
Find mysql, start it
2. The administrator opens cmd (must be the administrator or report an error)
3. Copy the mysql installation directory and the path of the bin folder
4.cd into the folder
cd C:\Program Files\MySQL\MySQL Server 8.0\bin
enter
mysqld -install
If successfully installed appears, the download is complete.
5. Create the initial configuration file my.ini in the installation directory
Enter the following
[mysqld]
basedir=C:\Program Files\MySQL\MySQL Server 8.0
datadir=C:\Program Files\MySQL\MySQL Server 8.0\data
port=3306
Note: The port number set here is 3306 by default. If 3306 is occupied, a port needs to be replaced.
6. Continue to enter the cmd command line in the bin directory
mysqld --initialize --console
Enter, enter
net start mysql
Now the problem is here.
Note * If this can be initialized, delete all the things in the data folder in the same folder as bin.
7. Don't be afraid, follow me to check the port
netstat -aon|findstr "3306"
It is found that it is occupied in this process.
We open the task manager, find the location of pid, find
the process number above, and end it.
8. Connect again and enter the command
net start mysql
over, I wish you can solve this problem too!