Basic MySQL environment construction

  1. Download
    the official download address
    insert image description here
    After completion, you will get a compressed package of mysql-8.0.19-winx64.zip

  2. Unzip
    I put it in C:\tools\mysql-8.0.19-winx64
    insert image description here

  3. 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

  4. Initialize the database
    Open CMD with a normal user and execute the following command:

mysqld --initialize-insecure 

insert image description here

Some students here may encounter an error, let’s search on Baidu and install
it
to solve it

  1. 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

  1. 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

insert image description here

  1. Login test
    Open CMD, run command
mysql -uroot -p

Click the Enter key twice in a row to enter.
insert image description here
Your MySQL installation is basically completed in the car. Next, I will introduce other

  1. 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 .
    insert image description here
    (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)
insert image description here

  1. 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';

insert image description here

(3) 刷新权限
flush privileges;

insert image description here

Now you can use some tools to remotely manage MySQL on this host
, such as Navicat 15 for MySQL

Guess you like

Origin blog.csdn.net/qq_40166810/article/details/120524266