-
Download
the official download address
After completion, you will get a compressed package of mysql-8.0.19-winx64.zip -
Unzip
I put it in C:\tools\mysql-8.0.19-winx64
-
Add the environment variable PATH
for later convenience, add the decompressed bin directory to the environment variable, and then open the command line to use the command directly without switching directories. What? You don’t know how to add environment variables???
Poke me See what Baidu experience does -
Initialize the database
Open CMD with a normal user and execute the following command:
mysqld --initialize-insecure
Some students here may encounter an error, let’s search on Baidu and install
it
to solve it
- Install as a service
Run CMD with an administrator account (right-click the command line prompt, run as an administrator)
and execute the following command:
mysqld --install
The returned result is: Service successfully installed. That means you succeeded
- Start the service
Run CMD with an administrator account (right-click the command line prompt, run as an administrator)
and execute the following command:
net start mysql
- Login test
Open CMD, run command
mysql -uroot -p
Click the Enter key twice in a row to enter.
Your MySQL installation is basically completed in the car. Next, I will introduce other
- Modify the default root password
Just now we used the command mysql -uroot -p, followed by -u is the root user -p followed by nothing, let us enter the password after the first press enter, but we have nothing Enter, then click Enter again, indicating that the default password is empty, which is not very safe, so we need to change the default password (1) Use the exit; command to exit the
mysql interface just now, and return to the path .
(2) Execute command:
mysqladmin -uroot -p password 123
Analysis: Follow the password with the password you want to change. I use 123 as the password.
After executing the command, you need to verify the current password to change it. Enter your current password after Enter password: (if you are a newly installed mysql , Just press Enter)
- Set remote login
(1) use the command mysql -uroot -p to log in
(2) modify the user table, execute the command:
use mysql;
update user set host = '%' where user = 'root';
(3) 刷新权限
flush privileges;
Now you can use some tools to remotely manage MySQL on this host
, such as Navicat 15 for MySQL