MySQL 5.7.26 installation and uninstallation

surroundings:

  win10 (local)

  MySQL version: mysql-5.7.26-winx64

 

First, uninstall

1. Stop the MySQL service
2. Delete the MySQL installation directory
3. Clean MySQL-related registry
HKEY_LOCAL_MACHINE / the SYSTEM / ControlSet001 / Services / Eventlog / the Application / MySQL 
HKEY_LOCAL_MACHINE / the SYSTEM / ControlSet002 / Services / Eventlog / the Application / MySQL 
HKEY_LOCAL_MACHINE / the SYSTEM / CurrentControlSet / Services / Eventlog / Application / MySQL
if there is no corresponding folder, do not delete; and finally by Ctrl + F to find it again MySQL again, can find relevant registration information is deleted
4. restart

 

 Second, the installation

1. Oracle's official website to download the Community Edition (mysql-5.7.26-winx64.zip decompression version)

 MySQL Download: https://downloads.mysql.com/archives/community/

2. Unzip the downloaded file (unzip here to the D: \ MySQL-5.7.26)

--MySQL-5.7.26
  |--bin
  |--docs
  |--include
  |--lib
  |--share
  |--COPYING
  |--README

3. Create a directory data store data, configuration information for MySQL my.ini new

In D: \ MySQL-5.7.26 Create a data storage directory data, a new configuration file my.ini

--MySQL-5.7.26
  |--bin
  |--docs
  |--data
  |--include
  |--lib
  |--share
  |--COPYING
  |--README
  |--my.ini

my.ini add the following content (simple version configuration):

[Client] 
# Set the port connection server used by default mysql client 
Port = 3306 
default-Character-SET = UTF8 

[mysql] 
# Set mysql client default character set 
default-Character-SET = UTF8 

[mysqld] 
# Set 3306 port 
port = 3306 
# mysql installation directory setting 
the basedir = D: \ the mySQL 5.7.26- 
# mysql database data set storage directory 
DATADIR = D: \-the mySQL 5.7.26 \ data 
# maximum number of connections 
max_connections = 200 is 
# allowing the number of connection failures to prevent people from trying to attack the database system from the host 
max_connect_errors = 10 
# character set the server uses the default is UTF8 (default is 8-bit encoding latin1 character set) 
character-the sET-Server = utf8 
# create a new table the default storage engine that will be used when the 
default-storage-engine = INNODB  
# default mysql_native_password plug-in authentication (authentication credentials can be used in addition to mysql.user system tables, such as PAM, Windows logon ID, LDAP or Kerberos)
default_authentication_plugin = mysql_native_password 
use if you forget your password #
#skip-grant-tables

4. to administrator tune the powershell command line interface terminal

5. MySQL directory to extract the bin directory, execute mysqld install, installation services MySQl

PS C:\WINDOWS\system32> cd D:\MySQL-5.7.26\bin\
PS D:\MySQL-5.7.26\bin> .\mysqld.exe install
Service successfully installed.
The results show Service successfully installed the service installation was successful

6. initialization data directory

PS D:\MySQL-5.7.26\bin> .\mysqld.exe --initialize-insecure

(Note: mysqld --initialize-insecure generated automatically without user password root, mysqld --initialize automatically generated sequence with the root user password) 

7.net start mysql start MySQL service

D PS: \ MySQL-5.7.26 \ bin> NET Start MySQL   
. MySQL service is starting 
MySQL service has started successfully.

8. change the root password

PS D:\MySQL-5.7.26\bin> .\mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.26 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> alter user 'root'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

9. Turn on remote access to the root user

For convenience, set up after the implementation of MySQL environment variables

# Connect to the database 
PS C: \ the Users \ cchengyyj> mysql -p-uroot- 
the Enter password: ****** 
# use mysql database 
mysql> use mysql; 
Database changed 
# command to query the user table 
mysql> the SELECT the User, authentication_string, from Host User; 
+ --------------- + ------------------------------- + ----------- + ------------ 
| the User | authentication_string | Host | 
+ --------------- + - ------------------------------------------ + ------- + ---- 
| root | * 6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | localhost | 
| mysql.session | * THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | localhost |
| mysql.sys     | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | localhost |
+ --------------- + --------------------------------- + ----------- + ---------- 
3 rows in the SET (0.00 sec) 
# telnet authorized 
MySQL> GRANT ALL PRIVILEGES ON *. * the TO 'root' @ ' % 'the IDENTIFIED BY' 123456 '; 
query the OK, 0 rows affected,. 1 warning (0.00 sec) 
MySQL> the flush privileges ; 
query the OK, 0 rows affected (0.00 sec) 
# again query the user table command 
MySQL> SELECT the user, authentication_string, the Host User from; 
+ --------------- + ------------------------------ + ----------- + ------------- 
| the User | authentication_string | Host | 
+ --------------- + ------------------------------------------- + ------ ----- +
| root          | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | localhost |
| mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | localhost |
| mysql.sys     | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | localhost |
| root          | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | %         |
+---------------+-------------------------------------------+-----------+
4 rows in set (0.00 sec)

 

Guess you like

Origin www.cnblogs.com/youngyajun/p/11543665.html