On MySQL reset password

Time:2020-2-17

When a novice starts using mysql, he may easily forget his login password. Let’s talk about how to reset and modify the password

The first method: operate directly in the command line window
Stop the server MySQL (this is the key point: stop directly)
Open CMD and input MySQL installation disk in command line window
Then enter the bin path under the MySQL installation directory, such as E > CD amp \ mysql5.5 \ bin, enter > mysqld — skip grant tables (except for the space in front of — skip, the other several must be connected together)
The command line window will then fail to enter
Then open another CMD window
Same as above, enter bin path
Then input MySQL directly, and only MySQL is needed
You can skip password verification and enter the MySQL welcome interface
Then change the password
grammar
update mysql.user password=password(123456) where user=’root’
Successfully modified login password
Then refresh (the refresh process is to extract the permission table from the MySQL database to the memory without restarting the server, so as to avoid unsuccessful login next time. The refresh can be viewed directly, so as to effectively avoid login failure.)
flush privileges
Refresh success
Then quit
Close all CMD windows
Then open a new window and enter the password

 

The second method: modify the configuration file in the MySQL root directory
#Find MySQL root
#Locate the my.ini configuration file in the root directory
#Locate find [mysqld]
#After [mysqld], press enter to the next line,
#Move out a cell and input skip grant tables (pasted together at the crossbar, otherwise it is easy to fail to restart the server), (it belongs to skipping the password verification process and reducing the security of the database)
#Restart the database service (important, the server needs to be restarted and cannot be shut down)
#Open CMD command line window
#Directly enter MySQL – uroot – P (no need to enter the installation path)
#Enter directly to skip the password entry step
#Login successful
#Start setting password (update mysql. User set password = password (123456) where user =’root ‘)
#Flush privileges / PR ɪ V ə L ɪ D ʒ /)
#Exit to find my.ini and delete skip grant tables
#Restart the database server

Key points
1. If MySQL installation path is installed on Disk C, you do not need to enter MySQL installation path in the command line window. Enter the command statement to skip the verification code directly.

Recommended Today

Wechat applet package pull-up load and pull-down refresh components

Wechat applet encapsulationPull up loading、Drop-down refreshassembly Effect GIF diagram Drop-down refreshPull up loading Custom pull-up loading and pull-down refresh component encapsulation scroll.wxml <video/> <scroll-view class=”message scroll-view client-pool-list” scroll-y=”{{true}}” lower-threshold=”1″ bindtouchstart=”touchstart” bindtouchmove=”touchmove”> <view class=”pull-refresh {{pull.isLoading ? ‘chu’ : ‘jin’}}” id=”pull-refresh”> <image class=”icon-refresh z-index-1″ /> <view class=”fs24 pt20 f-color-666 z-index-1″>{{pull.pullText}}</view> </view> < slot > < / slot […]