mysql-8.0.19-winx64. Installation and uninstallation of zip

1, Installation

1. Download mysql

Official website: https://dev.mysql.com/downloads/mysql/ , I use the latest version 8.0.19. The version format is zip, as shown in the figure below

2. Unzip to the specified path, as shown in the following figure

3. In order to facilitate operation, add the Path of bin folder under this directory to the system environment variable Path. In addition, note: when developing mysql, you also need to add libmysql under lib folder DLL into C:\Windows\System32.

2, Install mysql service

mysql-8.0.19 can be installed in two ways. Mode 1: do not configure my Ini can be installed. Mode 2: configure my Ini (this method can be customized to set database parameters, recommended)

Mode 1:

1. Run command window (open as administrator)

2. Input: mysqld --initialize --console. If successful, a random password will be generated. Note that the generated password will be recorded. It will be used when entering mysql for the first time

3. Enter: mysqld --install to prompt the successful installation of mysql service. If you prompt The service already exists!, Note: it has been installed before. Use the mysqld -remove MySQL command to uninstall it first.

4. Enter: net start mysql to start the mysql service

5. Enter: mysql -uroot -p, and then enter the password generated above to enter the mysql welcome interface

6. Change the root password and enter: alter user root@localhost identified by 'new password'; (sql statements usually end with a semicolon)

7. In order to visually manage the database, third-party software, such as Navicat Premium, can be downloaded and installed by yourself.

Mode 2:

1. Create a new my. In mysql-8.0.19-win64 folder INI file, where # the beginning indicates comments, and some parameters can be customized, as follows:,

[mysqld]
# The needs of master and slave libraries are inconsistent
server-id=1
log-bin=mysql-bin
# Databases that need to be synchronized
#binlog-do-db=test
# Databases that do not need to be synchronized
#binlog-ignore-db=mysql
# Set 3306 port
port=3306
# Set mysql installation directory
basedir=D:\mysql-8.0.19-winx64
# Set the storage directory of mysql database data
datadir=D:\mysql-8.0.19-winx64\Data
# Maximum connections allowed
max_connections=200
# Number of connection failures allowed.
max_connect_errors=10
# The character set used by the server is UTF8 by default
character-set-server=utf8
# The default storage engine that will be used when creating new tables
default-storage-engine=INNODB
#Plug in authentication method caching_sha2_password and mysql_native_password
default_authentication_plugin=mysql_native_password
[mysql]
# Set the default character set of mysql client
default-character-set=utf8
[client]
# Set the default port used by mysql client when connecting to the server
port=3306
default-character-set=utf8

 

2. Run command window (open as administrator)

3. Input: mysqld --initialize --user=mysql --console. If successful, a random password will be generated. Note that the generated password will be recorded. It will be used when entering mysql for the first time

C:\WINDOWS\system32>mysqld --initialize --user=mysql --console
2021-06-12T10:22:35.549746Z 0 [System] [MY-013169] [Server] D:\mysql-8.0.19-winx64\bin\mysqld.exe (mysqld 8.0.19) initializing of server in progress as process 12560
2021-06-12T10:22:35.550988Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2021-06-12T10:22:51.168343Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: >=9e74Frh6fE

C:\WINDOWS\system32>

4. Input: mysqld -- install MySQL -- defaults file = "D: \ mysql-8.0.19-winx64 \ my. Ini", where MySQL is the service name

C:\WINDOWS\system32>mysqld --install MySQL --defaults-file="D:\mysql-8.0.19-winx64\my.ini"
Service successfully installed.

C:\WINDOWS\system32>

5. Enter: net start mysql to start the mysql service

C:\WINDOWS\system32>net start mysql
MySQL The service is starting ..
MySQL The service has been started successfully.


C:\WINDOWS\system32>

6. Enter: mysql -uroot -p, and then enter the password generated above to enter the mysql welcome interface

C:\WINDOWS\system32>mysql -uroot -p
Enter password: ************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.19

Copyright (c) 2000, 2020, 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>

7. Change the root password and enter: alter user root@localhost identified by 'new password'; (sql statements usually end with a semicolon)

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

mysql>

8. In order to visually manage the database, third-party software, such as Navicat Premium, can be downloaded and installed by yourself.

3, Configure remote access:

Run command window

Input: mysql -uroot -p, enter the new password after modification to log in;

Switch to mysql database and enter: use mysql;

Query the user and host in the user table. Enter: select user,host from user; Currently, all users are logged in locally

Change the host of the user who needs remote access to% and enter: update user set host = '%' where user = 'root';  

Refresh: flush privileges;

The above steps are shown in the figure below

IV. unloading

1. Stop the MySQL service through the command line. Enter: net stop mysql; You can also right-click - > Computer - > Management - > services and applications - > services to find MySQL and right-click to stop.

2. To uninstall the mysql service, enter sc delete mysql or mysqld -remove MySQL on the command line

2. Run the registry, win+R, enter regedit, and open the registry.

Delete HKEY_ LOCAL_ Machine \ system \ controlset001 \ services \ eventlog \ application \ MySQL service folder

Delete HKEY_ LOCAL_ Machine \ system \ controlset002 \ services \ eventlog \ application \ MySQL service folder

Delete HKEY_ LOCAL_ Machine \ system \ currentcontrolset \ services \ eventlog \ application \ MySQL service folder

One or more of the above may be deleted

3. Input in the command line window: sc delete mysql prompts that the deletion is successful!

4. Just clear the folder where mysql is installed.

Keywords: MySQL

Added by benyboi on Sun, 30 Jan 2022 10:29:36 +0200