MySQL complete uninstallation and installation tutorial
Uninstall
1. Stop mysql service in task manager
- Uninstall the MySQL application in the control panel
- Delete Mysql related files
- Delete the mysql folder inside
4. Delete the registry
- Delete the content:
删除HKEY_LOCAL_MACHIN->ControlSet001->SYSTEM-> service->MySQL;
删除HKEY_LOCAL_MACHINE->ControlSet002-> SYSTEM-> services->MySQL;
删除HKEY_LOCAL_MACHINE->CurrentControlSet-> SYSTEM-> services->MySQL
If not, it means it has been uninstalled cleanly!
installation
Disclaimer: I won’t talk about the exe version here, just go to the official website to download it and install it with one click.
Suggestion: Use the compressed version to uninstall!
Here's how to install the compressed version:
Go to the official website to download the corresponding version of the compressed package, I am here to take 5.7 as an example
Unzip after download
Enter the unzipped directory
Create a my.ini file:
The configuration is as follows:
[mysqld]
# 端口号
port=3306
# 压缩包目录
basedir=D:/DataBase/soft/mysql-5.7/
# 等会儿生成的data目录,用来存放数据的
datadir=D:/DataBase/soft/mysql-5.7/data/
# 跳过密码检查
skip-grant-tables
note:这里记得配置目录的斜杠方向 ‘ / ’,我就踩了这个坑,不然后面初始化目录会失败
Run CMD as administrator
Switch to the bin directory of the mysql decompression directory
cd /d D:\DataBase\soft\mysql-5.7\bin
Run the command to install the mysql service
Must be executed in the bin directory
mysqld -install
Initialization data
mysqld --initialize-insecure --user=mysql
After successful execution here, a data folder will be generated in the mysql directory
After success, start the service
net start mysql
Login to mysql
Note that there is no password here, so there is no need to enter a password
mysql -u root -p
Don't write anything here, just press Enter!
This shows that the login is successful:
After entering, update the password
update mysql.user set authentication_string=password('121891') where user='root'
and Host = 'localhost';
Refresh permissions
flush privileges;
Before deleting, the password configured in my.ini skips checking the configuration
Restart MySql
net stop mysql
net start mysql
At this point, the installation is complete!