MySQL download and installation

MySQL download and installation
1. Download

Address: https://dev.mysql.com/downloads/mysql/
The latest version is 8.0, I choose the latest mysql-5.7.24-winx64.zip

< img src="//i2.wp.com/img-blog.csdnimg.cn/20181028104229374.?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaX hpbl80Mjg2OTM2NQ==, size_27, color_FFFFFF, t_70">

2. Installation

There are two types of MySQL installation files: .msi and .zip, and .msi needs to be installed

The zip format is decompressed by yourself. After decompression, MySQL can be used, but you need to configure the environment variables. The zip format is decompressed by yourself.
My Computer -> Properties -> Advanced -> Environment Variables
Select Path and add after it: the path of your mysql bin folder:
F:\mysql\mysql-5.7.24-winx64\mysql-5.7.24-winx64\bin;

After configuring the environment variables, add a new configuration file mysql.ini in the F:\mysql\mysql-5.7.24-winx64\mysql-5.7.24-winx64 directory, and create a data file in the bin directory at the same level Folder (for storing database data)

The content of the mysql.ini file is as follows

[mysql]

# Set the default character set of the mysql client
default-character-set=utf8

[mysqld]

#Set port 3306
port = 3306

# Set the installation directory of mysql
basedir=F:\mysql\mysql-5.7.24-winx64\mysql-5.7.24-winx64

# Set the data storage directory of the mysql database
datadir=F:\mysql\mysql-5.7.24-winx64\mysql-5.7.24-winx64\data

# Maximum number of connections allowed
max_connections=200

# The character set used by the server defaults to the 8-bit encoded latin1 character set
character-set-server=utf8

# The default storage engine that will be used when creating new tables
default-storage-engine=INNODB

Open cmd, no need to enter the installation directory (∵ configured environment variables before), enter the following command, press Enter, no response

mysqld --initialize-insecure --user=mysql

Enter the following command, press Enter, it will prompt that the installation is successful

mysqld install

Start the service, enter the following command, and press Enter. After the startup is successful, the following figure is shown

net start mysql

After the service is successfully started, enter the command when you need to log in (the first time you log in without a password, just press Enter)

mysql -u root -p

Change the password (mysql must be started first), execute the following command and press Enter, enter password also press Enter, the password is generally set to root for easy memory

mysqladmin -u root -p password

Exit exit is fine, remember to close the cmd window directly, there is no exit, you have to enter exit to exit

Close mysql boot self-start

  • Enter Services.msc in the run

  • Mysql right-click attribute, automatically changed to manual

3. Navicat graphical interface connects to mysql

  1. new connection

  2. Fill in the connection ip and password

  3. Check if it is connected

    The reason for the following situation: mysql is not started