Table of contents
1. Download Mysql
Download MySQL from the official website . Here I choose version Mysql8.0.34
2. Install Mysql
After the download is complete, double-click to install. The page that opens will look as follows:
“Developer Default” is the developer default
"Server only" Install only as a server
"Clientonly" Install only as a client
"Full" is a complete installation
"Custom" is a custom installation
Select custom and then next step
After selecting, click OK, then click Next
Then wait for the operation to complete, and then continuously click Next
There is no need to modify anything here, continue to the next step.
Generally, traditional passwords are chosen here, depending on personal habits. and then next
Set your own mysql password here, confirm it and click Next
Continue to the next step without making changes.
Click Execute to execute (you need to wait for a while)
When execution is complete, click Finish, then click next, then click Finish.
At this point, the installation of Mysql has been implemented
3. Configure Mysql
After installation, right-click My Computer (some are This Computer) on the desktop, then click Properties to enter the system information settings.
Then click Advanced to enter the environment variables interface.
Enter the environment variable interface
Edit path variable
Then click OK and confirm again
Then hold down win+r and enter cmd
Then enter the command line
mysql -u root -p
After entering the mysql password. If the mysql version information appears, the configuration is successful.
The mysql password is the password you set when you installed MySQL.
At this point, you can use MySQL normally. But it would be too boring if you have to use the command line mode to enter the command every time you enter a sql statement. Therefore, visualization tools for connecting to databases appeared. For details, please see Chapter 4.
4. Connect to Mysql
There are many visualization tools for connecting to databases. There is mysql official mysql workbench, DataGrip, navicat and so on.
Here I choose navicat, which is a commonly used tool on the market.
There is a charge for the official download of this tool. For the free version, you can follow the V public account Xinghao Tool Station and enter navicat to get it.
After downloading, find the corresponding directory and find the corresponding exe executable file.
Double click the exe executable file
Then click Connect and select Mysql. Then enter the corresponding parameters
Then click OK. If you don't remember the password, you can click Connection Test to test whether the password is correct.
Then we successfully connected to the database
Do not delete database files such as mysql here casually.
If you want to create a new database, you can right-click the corresponding connection and click New Database.
5. Some difficult issues
Error content: 2058 (Plugin caching_sha2_password could not be loaded:)
[Possible reason] The new version of Mysql uses caching_sha2_pasword as the authentication plug-in by default. The old version uses mysql_native_password . When connecting to MySQL and an error occurs that plugin caching_sha2_password could not be loaded , you can switch back to the old version of the plug-in.
[Solution] Log in to MySQL through the command prompt cmd, and then enter the command.
[Solution steps]
1. Open cmd (win+R) and enter:mysql -u root -p
进入MySQL
2. Enter mysql and execute the following statement: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
(123456 is your preset root password. My password is: 123456