MySQL 5.7.19 installation tutorial under Windows 10 How to change the root password of MySQL after forgetting it

MySQL 5.7.19 installation tutorial under Windows 10 How to change the root password of MySQL after forgetting it

Take MySQL 5.7.19 installation as an example, first download

Of course, the first thing to do is to download https://dev.mysql.com/downloads/mysql/ official website download address.

Select the version suitable for your computer, click Download, jump, and download directly.

Quietly wait for downloading and decompression. This is my decompression path D:\MySQL

Officially start installation

: Windows 10

:MySQL5.7.19

After decompression

However, there is no my.ini, so just create one. Create a new text document->change the suffix to ini.

[Client]
#Set port 3306 port = 3306
[mysqld]
#Set port 3306 port = 3306
# Set your own MySQL installation directory basedir=D:\MySQL
# Set the storage directory of your MySQL database data datadir=D:\MySQL\data
# Maximum number of connections allowed max_connections=200
# The default character set used by the server is the 8-bit latin1 character set character-set-server=utf8
# The default storage engine that will be used when creating a new table default-storage-engine=INNODB
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysql]
# Set the client's default character set default-character-set=utf8

Then the next step is to configure the environment variables, just go to the picture above.

This computer -> right click, properties -> advanced system settings -> environment variables

Variable Name: MYSQL_HOME

Variable value: your own MySQL installation path

Next, add Path, select Path Edit, and add a new one: %MYSQL_HOME%\bin

All the way sure.

To open the command prompt, you must have administrator privileges, otherwise you will not have enough privileges.

cd /dD:\MySQL\bin to enter the bin directory. Go to the bin directory! It’s not written on the picture! Then press the command as shown in the picture.

Next, enter MySQL using mysql -u root -p. No password is required for the first entry, just press Enter. Because I installed it before, it requires a password.

Next update the password

MySQL 5.7 no longer has the PASSWORD field, which has been changed to authentication_string

SO:

mysql>update mysql.user set anthentication_string=password('your password') where user='root';

mysql>flush privileges; //Refresh MySQL system privileges

mysql>quit;

Enter mysql -u root -p again and you can operate.

mysql>show databases;

You can also download a MySQL graphical interface, such as SQLyog, Navicat, etc.

Forgot root password

Maybe you will forget your password after a while.

See picture.

First, use net stop mysql to stop the service;

If you can’t stop:

Press Ctrl+Alt+Del to open the Task Manager and end the mysql.exe task in the details.

Enter the bin directory

mysqld -nt --skip-grant-tables

Now this command prompt is no longer usable.

Reopen an administrator command prompt, enter mysql, and change the password again.

Wonderful topic sharing: Installation tutorials for different versions of MySQL Installation tutorials for MySQL 5.7 versions Installation tutorials for MySQL 5.6 versions

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed tutorial for installing mysql5.7.21 under Windows
  • Detailed tutorial for installing mysql5.7.21 under Windows system
  • Tutorial on installing mysql5.7.17 on windows10
  • MySQL 5.7 installation tutorial (windows)
  • Detailed graphic tutorial on how to install the unzipped version of MySQL under Windows 10
  • How to install and configure MySQL 8.0.12 decompressed version under Windows 10 with graphic tutorials
  • How to install and uninstall MySQL service under Windows (MySQL 5.6 zip decompression version installation tutorial)
  • Detailed tutorial for installing the unzipped version of mysql5.7.28 winx64 on windows

<<:  WeChat applet uses the video player video component

>>:  VMware workstation 12 install Ubuntu 14.04 (64 bit)

Recommend

Nginx rewrite regular matching rewriting method example

Nginx's rewrite function supports regular mat...

4 solutions to mysql import csv errors

This is to commemorate the 4 pitfalls I stepped o...

Detailed tutorial on deploying Apollo custom environment with docker-compose

Table of contents What is the Apollo Configuratio...

Steps of an excellent registration process

For a website, it is the most basic function. So l...

Vue3 slot usage summary

Table of contents 1. Introduction to v-slot 2. An...

Vue method to verify whether the username is available

This article example shares the specific code of ...

How to create a table by month in MySQL stored procedure

Without going into details, let's go straight...

Introduction to JavaScript array deduplication and flattening functions

Table of contents 1. Array flattening (also known...

A small introduction to the use of position in HTML

I just learned some html yesterday, and I couldn&#...

Docker View the Mount Directory Operation of the Container

Only display Docker container mount directory inf...

Introduction to Vue3 Composition API

Table of contents Overview Example Why is it need...

How to view Docker container application logs

docker attach command docker attach [options] 容器w...