Original URL:
Introduction
This article describes how to install MySQL8 using a compressed package on Windows.
download link
1. URL entry
Enter MySQL's official website: MySQL :: MySQL Community Downloads
2. Find "MySQL Community Server"
3. Download the Community version
In the page opened later, you can see the relevant download items, as shown below:
Graphical interface installation, select "Windows(x86, 64-bit), ZIP Archive", after entering the page:
Installation process
1. Unzip
First unzip the installation package you downloaded, move this folder to the place where you want to install mysql, that is, the directory you move to is the directory where mysql is installed, for example, mine is under D:\dev\MySQL.
2. Set environment variables
Right-click "This Computer" => Properties => Advanced System Settings => Environment Variables => System Variables => PATH => Add: the path of your mysql bin folder (eg: D:\dev\MySQL\mysql-8.0. 21-winx64\bin)
3. Modify the configuration file
Create the my.ini file in the root directory (here: D:\dev\MySQL\mysql-8.0.21-winx64\);
- Only basedir and datadir are required.
- The encoding of the my.ini file must be English encoding (such as ANSI in Windows, not UTF-8 or GBK, etc.).
[mysqld]
basedir=D:\dev\MySQL\mysql-8.0.21-winx64
datadir=D:\dev\MySQL\mysql-8.0.21-winx64\data
port = 3306
max_connections=200
character-set-server=utf8
default-storage-engine=INNODB
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysql]
default-character-set=utf8
4. Installation, initialization and settings of mysql service
Then run cmd.exe as an administrator; (there are three words "administrator" in the upper left corner of the command window).
Install
mysqld -install
initialization
mysqld --initialize-insecure --user=mysql
start up
net start mysql
5. Login
After entering cmd, enter:
mysql -u root -p
There is no password at the beginning, just press Enter
quit: quit
6. Change password
mysqladmin -u root -p password New password => Enter => Enter the old password (if you just installed, do not enter) => Enter
7. Exit
quit or exit
8. Restart MySQL
net stop mysql
net start mysql
problem solved
error phenomenon
An error is reported when mysql -v is executed:
reason
This error is caused by not having vcredist installed
solution
Download vcredist address:
The latest supported Visual C++ downloads
Install the software you just downloaded, the location is the default, and you can re-execute it after the installation is successful.