1. Download the mysql version from the mysql official website

Dev.mysql.com/downloads/m…

2. Decompress the zip file in the local directory and create the my.ini file in the main directory (local directory: D:\mysql\mysql-8.0.25-winx64) and configure parameters in the file

[mysqld] # mysqld # mysqld # mysqld # mysqld # mysqld # mysqld # mysqld # mysqld # mysqld Basedir =D:\mysql\mysql-8.0.25-winx64\ mysql\mysql-8.0.25-winx64\ Datadir =D:\mysql\mysql-8.0.25-winx64\data\ # Set max_connections=200 # Set max_connections=200 # Max_connect_errors =10 # The default character set used by the server is UTf8MB4 character-set-server= UTf8MB4 # The default storage engine used when creating new tables is default-storage-engine=INNODB #mysql_native_password default_authentication_plugin=mysql_native_password [client] Port =3306 default-character-set=utf8mb4Copy the code

3. My Computer – > Properties – > Advanced System Settings – > Environment Variables

Select path Add: address of the bin folder in the mysql installation directory

Check whether an earlier version of Mysql has been installed before and delete its environment variables

4. Use the admin permission to open the CMD window, CD go to the bin directory of mysql installation, and run mysqld-install. Run the sc delete mysql command to delete the old mysql service and then install it. Then run mysqld-install. If you encounter problems with.dll files, you will need to download the Microsoft plug-in

Link: pan.baidu.com/s/1EQBmbdD3…

Extraction code: XBW1

Install mysqld-install

Mysqld –initialize –console

Mysqld –initialize — insecure –user=mysql

6.net start mysql Starts the mysql service

7. Log in to mysql -uroot -p

ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘your password ‘;

Create user ‘username’@’host’ identified by ‘password’;

Host means permission

  • % (wildcard) indicates all address permissionsCopy the code
  • Localhost indicates the local permissionCopy the code
  • Specifying an IP address indicates special access rightsCopy the code

10. Query user information: use mysql; select host,suer,authentication_string,plugin from user;

Grant auth on. [database.table] to ‘username’@’host’;

Auth stands for permission:

  • all privileges
    Copy the code
  • select
    Copy the code
  • select,insert,update,delete
    Copy the code
  • select,[...]
    Copy the code

12. Refresh Authorization Privileges;

Select * from ‘username’@’host’;

[database.table] from ‘username’@’host’;

Drop user ‘username’@’host’;