Tutorial on configuring and changing passwords for the MySQL free installation version

Tutorial on configuring and changing passwords for the MySQL free installation version

Step 1: Configure environment variables (my decompression path: G:\mysql\mysql-5.7.21-winx64)

MYSQL_HOME = the path where you unzipped the file

PATH = ;%MYSQL_HOME%\bin;

The PATH variable is added on the basis of the original one, do not delete the other settings

The second step is to add the my.ini file in the unzipped directory (if this file already exists, just replace the content inside)

The file content is

[client]
 port=3306
 default-character-set=utf8
[mysqld]
 port=3306
 character_set_server=utf8
 #Unzip directory basedir=G:\mysql\mysql-5.7.21-winx64
 #Unzip the data directory datadir=G:\mysql\mysql-5.7.21-winx64\data
 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[WinMySQLAdmin]
 G:\mysql\mysql-5.7.21-winx64\bin\mysqld.exe 

Step 3: Run cmd as an administrator (search Baidu if you don’t understand), then enter the bin folder in the decompressed path, execute the mysqld -install command, and then create a data folder in the decompressed path (without content)

Step 4: Log in

Open cmd as an administrator, then enter mysql -uroot -p and press Enter without a password (the default password is empty)

Step 5: Change password

First, use net stop mysql to stop the mysql service, and then add a skip-grant-tables section to the my.ini file.

Then start the MySQL service and modify the authentication_string field value of the root user in the user table in the MySQL data source (originally the password field, later changed to authentication_string)


After success, delete the skip-grant-tables in the my.ini file and you're done.

If an error occurs:

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

It is because the password has expired. You can set it like this

set password = password('mysql');
use mysql
update user set password_lifetime = 0 where User='root';
flush privileges;

Summarize

The above is the tutorial on configuring and changing the password of the MySQL free installation version introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • MySQL 5.7 installation-free configuration graphic tutorial
  • Detailed tutorial on configuration method of Mysql 5.7.19 free installation version (64-bit)
  • MySQL 5.7.18 free installation version configuration tutorial
  • mysql5.7.18.zip Installation-free version configuration tutorial (windows)
  • MySQL installation and configuration tutorial for win10 free installation version
  • MySQL 5.7.17 free installation version configuration method graphic tutorial (windows10)
  • Mysql 5.7.17 winx64 free installation version, installation and configuration graphic tutorial under win10 environment

<<:  Example of how to configure nginx in centos server

>>:  React Synthetic Events Explained

Recommend

MySQL 8.0.12 installation configuration method and password change

This article records the installation and configu...

Detailed tutorial on installing MySQL 5.7.20 on RedHat 6.5/CentOS 6.5

Download the rpm installation package MySQL offic...

MySQL multi-table join query example explanation

In actual projects, there are relationships betwe...

Node.js+postman to simulate HTTP server and client interaction

Table of contents 1. Node builds HTTP server 2. H...

Introduction to keyword design methods in web design

Many times, we ignore the setting of the web page ...

CSS code to distinguish ie8/ie9/ie10/ie11 chrome firefox

Website compatibility debugging is really annoyin...

Several ways to hide Html elements

1. Use CSS Copy code The code is as follows: style...

A brief discussion on event-driven development in JS and Nodejs

Table of contents Event-driven and publish-subscr...

JavaScript typing game

This article shares the specific code of JavaScri...

Detailed explanation of Linux zabbix agent deployment and configuration methods

1. Install zabbix-agent on web01 Deploy zabbix wa...

Navicat multiple ways to modify MySQL database password

Method 1: Use the SET PASSWORD command First log ...

HTML head tag meta to achieve refresh redirection

Copy code The code is as follows: <html> &l...