Home > Database > Mysql Tutorial > body text

How to reinstall mysql

藏色散人
Release: 2020-10-26 15:32:10
Original
23249 people have browsed it

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.

How to reinstall mysql

# Recommended: "

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.

Processing

  1. Stop mysql service

    net stop mysql

  2. Uninstall mysql service

    cd C: \Program Files\mysql\bin
    mysqld -remove

  3. Delete file

    Delete the entire folder C:\Program Files\mysql

  4. Delete the registry

    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

The above is completed Completely uninstall the old mysql, and install the new mysql below.

5. Download the green version of mysql and unzip it

地址 http://dev.mysql.com/downloads/mysql/
Copy after login

6. Create my.ini configuration file

在解压后的目录下创建my.ini配置文件,内容
Copy after login

[mysql]

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

7. Enter the installation directory and install Service

cd E:\Program Files\mysql\bin

mysqld -install (needs to run as administrator)

If the following prompt appears,


How to reinstall mysql 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)

8. Initialize data

After decompressing the new version of mysql The installation directory does not have a data folder and needs to be initialized. **Note that it cannot be created manually, **because an initial root password is randomly generated during initialization. The initialization command is as follows:

mysqld --initialize
Execute this command or default a password,

mysqld --initialize-insecure

If you execute this command, there will be no password by default.

At this time, the data folder is generated in the installation directory.

Enter the data file and open a file ending with .err, which contains the initialization password

How to reinstall mysql

9. Start the service and change the password

net start mysql
mysql - u root -p
Enter the initialization password,
If there is no password, mysql -u root

10. Change the password

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!