Installation, configuration and uninstallation of MySQL 5.7

Installation, configuration and uninstallation of MySQL 5.7

Install

Official website download address : https://dev.mysql.com/downloads/mysql/
(1) After entering the download page, click Archives
insert image description here
(2) Select 5.7.X for the MySQL installation version, here I choose 5.7.34, or you can choose other . Then select download behind ZIP Archive to download. Extension: ZIP Archive, Debug Binaries & Test Suite, this is the MySQL debugging information file. They are provided for download in the form of separate compressed packages, and are divided into debugging files in 32-bit and 64-bit environments (not used, no download required). Note: The installation of MySQL is divided into installation version and installation-free version. This installation is the installation-free version, just decompress the compressed package. (3) After the download is complete, unzip it. (4) I put the decompressed files on the D disk, such as: D:\dev\mysql-5.7.34-winx64. (You can decompress it to the directory you specify according to your own needs.) Directory description :

insert image description here


insert image description here

insert image description here

  • /bin: Store executable files, mainly including client and server startup programs, such as mysql.exe, mysqld.exe, etc.
  • /docs: store some documents
  • /include: used to place some header files, such as: mysql.h, mysqld_error.h, etc.
  • /lib: stores some class library files
  • /share: Mainly store some character set files

configuration

(1) Configure environment variables
Step 1: Right-click Computer > Properties > Advanced Environment Settings insert image description here
insert image description here
Step 2: Click Environment Variables, click New in System Variables, the variable name is MYSQL_HOME, and the variable value fills in your decompressed mysql path.
insert image description here
insert image description here
Step 3: Find Path in the system variables and double-click, click New, add %MYSQL_HOME%\bin
insert image description here
(2) Enter the mysql-5.7.34-winx64 folder, configure my.ini, if not, create
insert image description heremy.ini The configuration content is as follows:

[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录
basedir=D:\dev\mysql-5.7.34-winx64
# 设置mysql数据库的数据的存放目录
datadir=D:\dev\mysql-5.7.34-winx64\data
# 允许最大连接数
max_connections=200
# 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统
max_connect_errors=10
# 服务端使用的字符集默认为UTF8
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 默认使用“mysql_native_password”插件认证
default_authentication_plugin=mysql_native_password
# 配置时区
default-time-zone = '+8:00'
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306

(3) Initialize the MySQL service, run cmd as an administrator, and execute in sequence

mysqld install
mysqld --initialize
net start mysql

(4) After the service is successfully started, open the data directory of mysql, edit the file with the suffix .err, there is a message similar to this, eq#iWy&Zs24e behind localhost is your initial password (the initial password is different, just fill it out truthfully. Can)

[Note] A temporary password is generated for root@localhost: eq#iWy&Zs24e

(5) Open the command line window, run the following command and enter the MySQL initial password to successfully enter the MySQL command line interface.

mysql -u root -p

(6) Change the MySQL password, my password is root (can be specified by yourself)

alter user root@localhost identified by 'root';

(7) Enter exit to exit, log in again, and the following interface is displayed, which means success.
insert image description here
The above is the installation and configuration tutorial of the free installation version of MySQL 5.7.34. As long as you are patient and careful, I believe everyone can install it successfully. Come on everyone!

uninstall

How to completely uninstall MySQL (if MySQL has not been uninstalled cleanly, it will not work if you want to reinstall)
(1) Stop the mysql service first, "run as administrator" --> "cmd" --> input "net stop mysql;"
insert image description here
( 2) Enter the control panel to uninstall mysql; Control Panel --> "Programs", find and uninstall! (Note: This step is not required for the installation-free version)
(3) Find the installation path, and uninstall all the folders about mysql
(4) Run the "regedit" file, open the registry and select
insert image description here
 the top "computer", which means Look up the registry for "mysql" on the entire computer!
 Click "Edit" --> "Search" --> enter "mysql" (case insensitive). ——> "Find Next".
Search for "mysql" and delete it! !
insert image description here
  Then there is "Edit" --> "Find Next" (or press "F3"). Repeat the above action! ! If you find it, delete it! ! ! Until the deletion is complete~
(5) Delete all the files of "C:\ProgramData\MySQL" under the C drive. If you can't delete it, you can use 360 ​​to smash it. The programData file is hidden by default. It can be seen after setting the display, or directly Copy the above address to the address bar and press Enter to enter! (The free installation version may not have this file, if there is, you can delete it, if not, don’t worry about it)

The above is the uninstallation tutorial. Uninstallation is still relatively cumbersome. It must be cleaned up, otherwise it will be very troublesome to install later, so be careful! ! !

Guess you like

Origin blog.csdn.net/weixin_62222732/article/details/131042940