Installation and uninstallation of MySQL 5.7 decompressed version and summary of common problems

Installation and uninstallation of MySQL 5.7 decompressed version and summary of common problems

1. Installation

1. Download

Go to the MySQL official website http://dev.mysql.com/downloads/mysql/ to download MySQL

Note: msi is the installation version

2. Decompression

Unzip to the directory you want to install, mine is D:\mysql-5.7.13-winx64

3. Configure my.ini

Create a new my.ini file in the D:\mysql-5.7.13-winx64 directory and enter the following configuration code:

[mysqld]
# Set the installation directory of mysql basedir=D:\mysql-5.7.13-winx64
# Set the storage directory for mysql database data, which must be data
datadir=D:\mysql-5.7.13-winx64\data
#mysql port port=3306
# Character set character_set_server=utf8
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

4. Installation

Run cmd as an administrator and execute the following command:

mysqld -install [服務名]

Note: The default service name is mysql. If not necessary, it is recommended not to change it.

5. Initialization

mysqld --initialize-insecure

Note: There are two - in –initialize, and no space after it

After initialization, the data directory will appear in the D:\mysql-5.7.13-winx64 directory

6. Start the service

net start mysql

7. Log in to mysql and change the password

這里寫圖片描述  

Done!

2. Uninstall

1. Shut down the service

Run cmd as an administrator and execute the following command:

net stop mysql

2. Uninstall

mysqld -remove [服務名]

3. Delete files

4. Delete registry information

Clear the MySQL service in the registry. There are several places:

a. Delete the directory HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Eventlog\Application\MySQL

b. Delete the directory HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Services\Eventlog\Application\MySQL

c. Delete the directory HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\MySQL

The ControlSet001 and ControlSet002 in the registry are not necessarily 001 and 002, they may be ControlSet005, 006, etc. You can delete them all.

3. Frequently Asked Questions

1. Data file error

這里寫圖片描述

Reason: This error will occur if the data file already exists before initialization, or some files are missing from the data file.

Solution: Execute mysqld -remove first, then delete the data file. If the deletion fails, restart it, and then reinstall it without any problem. If you want to keep the previous data file, you can copy the data file to another place first, and then copy the extra files in the original data file after installation.

2. Wrong password

這里寫圖片描述

Reason 1: Using the mysqld –initialize method to install will generate a password consisting of a random string. This password can be found in the error log D:\mysql-5.7.13-winx64\data\green.err (green is the user name).

Reason 2: Forgot password

Solution: If you forget your password or cannot find the random password, you can skip the permission to modify the password by the following method

Run cmd as an administrator and execute the following command:

net stop mysql //Shut down the service mysqld --skip-grant-tables; //Set mysql login --skip-grant-tables mode

Open a new cmd

mysql//Log in to mysql directly

update mysql.user set authentication_string=password('123456') where user='root' and Host = 'localhost'; //Change password //One thing to note is that the new version of MySQL database does not have a Password field in the user table. Instead, the encrypted user password is stored in the authentication_string field.

flush privileges; //Refresh permissions and exit --skip-grant-tables mode. Very important!

Restart the computer, then mysql can connect

However, the operation seems to be incomplete at this time, and the password must be changed once while logged in

alter user 'root'@'localhost' identified by '123456';

You can also do this:

set password for 'root'@'localhost'=password('123456');

or like this:

set password=password('123456');

Summarize

The above is the installation and uninstallation of the decompressed version of MySQL 5.7 and a summary of common problems. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • How to install and uninstall MySQL 5.7.11 on Mac
  • How to install and uninstall MySQL service under Windows (MySQL 5.6 zip decompression version installation tutorial)
  • MySQL uninstall and install graphic tutorial under Linux
  • Detailed explanation of installing and completely uninstalling mysql with apt-get under Ubuntu
  • Ubuntu 16.04.1 MySQL installation and uninstallation graphic tutorial
  • Detailed tutorial on MySql installation and uninstallation
  • If MYSQL is not completely uninstalled, its installation will fail.
  • Detailed installation and uninstallation tutorial for MySQL 8.0.12
  • Complete step-by-step record of MySQL 8.0.26 installation and uninstallation

<<:  vue.config.js packaging optimization configuration

>>:  Detailed explanation of several methods of installing software in Linux

Recommend

How to connect XShell and network configuration in CentOS7

1. Linux network configuration Before configuring...

Vue large screen display adaptation method

This article example shares the specific code for...

JS Decorator Pattern and TypeScript Decorators

Table of contents Introduction to the Decorator P...

Write a simple calculator using JavaScript

The effect is as follows:Reference Program: <!...

Use render function to encapsulate highly scalable components

need: In background management, there are often d...

HTML+CSS3 code to realize the animation effect of the solar system planets

Make an animation of the eight planets in the sol...

How to view and optimize MySql indexes

MySQL supports hash and btree indexes. InnoDB and...

Chinese website user experience rankings

<br />User experience is increasingly valued...

Sqoop export map100% reduce0% stuck in various reasons and solutions

I call this kind of bug a typical "Hamlet&qu...

Common parameters of IE web page pop-up windows can be set by yourself

The pop-up has nothing to do with whether your cur...

Grid systems in web design

Formation of the grid system In 1692, the newly c...

Detailed explanation of :key in VUE v-for

When key is not added to the v-for tag. <!DOCT...

Nginx access log and error log parameter description

illustrate: There are two main types of nginx log...