# Recommended: "Mysql reinstallation method: first stop the mysql service; then enter the newly downloaded mysql directory and install the mysql service; finally start the service and log in.
mysql tutorial 》
Event process · Stop the mysql service: net stop mysql · Enter the directory of the currently installed mysql, enter the bin directory, and uninstall the mysql service:
cd C :\Program Files\mysql\bin
mysqld -remove
· Enter the newly downloaded mysql directory and install the mysql service:
mysqld -install
· The service is installed successfully, start the service and log in
net start mysql
mysql -u -root -p
The password is incorrect. It is found that the installed service is still the old mysql service under the C drive. After analyzing the reason, it should be that the previous one was not uninstalled cleanly.
net stop mysql
cd C: \Program Files\mysql\bin
mysqld -remove
Delete the entire folder C:\Program Files\mysql
Start cmd-> enter regedit-> search for mySQL, right-click to delete them all (or find MySQL according to the following path, right-click to delete)
HKEY_LOCAL_MACHINE/SYSTEM/ControlSet001/Services/Eventlog/Applications /MySQL
HKEY_LOCAL_MACHINE/SYSTEM/ControlSet002/Services/Eventlog/Applications/MySQL
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Eventlog/Applications/MySQL
地址 http://dev.mysql.com/downloads/mysql/
在解压后的目录下创建my.ini配置文件,内容
[mysql]7. Enter the installation directory and install Servicecd E:\Program Files\mysql\binmysqld -install (needs to run as administrator)If the following prompt appears,default-character -set=utf8
[mysqld]
basedir=D:\Program Files\MySQL\mysql-5.7.11-winx64
datadir=D:\Program Files\MySQL\mysql-5.7.11-winx64 \data
port=3306
max_connections=200
character-set-server=utf8
default-storage-engine=INNODB
Download VC redist packages for x64. When the download is complete, click to run.
(Website: https://www.microsoft.com/en-us/download/details.aspx?id=40784)
mysqld --initialize
Execute this command or default a password,
If you execute this command, there will be no password by default.
Enter the data file and open a file ending with .err, which contains the initialization password
net start mysql
mysql - u root -p
Enter the initialization password,
If there is no password, mysql -u root
mysql> set password for root@localhost = password('123') ;
The above is the detailed content of How to reinstall mysql. For more information, please follow other related articles on the PHP Chinese website!