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

mysql5.5 installation graphic tutorial under win7

MySQL installation is relatively simple, usually ...

Introduction to keyword design methods in web design

Many times, we ignore the setting of the web page ...

Summary of 9 excellent code comparison tools recommended under Linux

When we write code, we often need to know the dif...

mysql8.0.11 winx64 installation and configuration tutorial

The installation tutorial of mysql 8.0.11 winx64 ...

Vue implements multiple selections in the bottom pop-up window

This article example shares the specific code of ...

Analysis of the usage of Xmeter API interface testing tool

XMeter API provides a one-stop online interface t...

Will mysql's in invalidate the index?

Will mysql's IN invalidate the index? Won'...

Learn MySQL database in one hour (Zhang Guo)

Table of contents 1. Database Overview 1.1 Develo...

Details of watch monitoring properties in Vue

Table of contents 1.watch monitors changes in gen...

HTML4.0 element default style arrangement

Copy code The code is as follows: html, address, ...

Analysis of uniapp entry-level nvue climbing pit record

Table of contents Preface Hello World image Set b...

Detailed explanation of rpm installation in mysql

View installation and uninstallation # View rpm -...

jQuery plugin to implement floating menu

Learn a jQuery plugin every day - floating menu, ...