Version 5.7 is a very major version, and version 8.0 is a very major update. In fact, version 8.0 is version 5.8, but the minor version number is used instead of the major version number.
An operating system can run multiple mysql software at the same time, so it is no problem to install two versions of mysql at the same time.
The installation of 8.0 and 5.7 is similar, but the subsequent installation steps are different, because the mysql installer knows that you have installed a database, there will be a button to add a database, and the subsequent database installation steps will be relatively less.
Installation of MySQL 8.0
Install 8.0 first.
1. Open the download page
https://www.mysql.com/downloads/
Click MySQL Community (GPL) Downloads at the bottom, all of the above are paid versions.
2. Click MySQL Community Server.
3. Click the Go to Download Page button
Do not click the zip format compressed package below. This method requires additional configuration and is troublesome. Downloading is not recommended.
4. Download the offline installation package
There are two installers, one is offline and the other is online, offline is recommended. Of course you can choose the version, click Archives next to it.
I chose the version 8.0.26.
5. Start the installation
Choose Custom.
There will be many options, we just need to select MySQL Server 8.0.26-X64 and click the right arrow to move to the right part. Then select the MySQL Server 8.0.26-X64 on the right and an Advanced Options option will appear at the bottom right. Click this option to configure the installation location and data location of the database software.
The location can be modified.
Next, I will check the required environment and tell me that I need MV C++ 2019. If you have already installed it, there will be no such prompt. If you don’t directly click Execute, it will be downloaded automatically, and then you can install it directly. It is very simple.
If successful, the following interface will appear, click Execute to actually start installing the MySQL ontology.
If there is no problem, you will enter the next step of configuration.
Here you can directly go to the next step. There are three options for Config Type. Just learn to choose the first one, which takes up less memory. The second option means that there are multiple databases at the same time. MySQL is only one of them, and the memory usage is medium. The third option means MySQL Alone, will take up as much memory as possible.
Password type, choose the first one.
Set a password, nothing to say. You can add users below, but don't add them now.
Configure the Windows service, the service name can be modified here, and the service can be seen in the Windows management interface.
Click Execute to execute the configuration.
The following interface appears, indicating that the installation is successful.
6. Environment variables
Finally, you need to set the environment variable.
Open a new cmd window and enter mysql --version. If the following content appears, the installation is successful.
Log in with the root account, enter the password and the following content appears, indicating that the login is successful.
MySQL5.7 installation
Download the installer of MySQL5.7, the steps are the same as those of 8.0.
Click the downloaded installer, and the following interface will appear, Welcome Back! Very strange, why does it display Welcome Back? Because the installer already knows that you have another version installed.
The next step is to ask if you want to update? Here we remove the tick and click cancel.
The following interface will appear.
Click add and a familiar interface will appear. Select MySQL Sever 5.7.38-X64 and add it to the right. Select MySQL Sever 5.7.38-X64 on the right, and an Advanced Options will appear.
It prompts that MV C++ 2013 is required, just click Execute and let him download it by himself. Then install it manually, it's very simple.
When ready, click Execute.
It's time for configuration.
The port needs to be changed, here it is changed to 13306, and the port range is 0 to 65535.
Set the password.
The default will do.
Click Execute.
Finally, this interface appears. Indicates that both versions are installed.
version switching
To switch between the two versions, you can use the following command to switch, in fact, specify the port number, and mysql will automatically switch for us. It is not recommended to use environment variables to switch, because only one environment variable can take effect, and the previous one will take effect .