When you install MySQL, you will be given an initial password, and this initial password is particularly disgusting with a bunch of uppercase and lowercase special characters. Remember, it is impossible. If you have no installation experience before, you will most likely not pay attention to this when you install it yourself for the first time. The MySQL version used in this tutorial is version 8.0.19. This method should be available for version 8. I’m not sure about other versions, so you can try it. If you are proficient in the whole process, it can be done in two minutes. First, the tutorial. Just do it, the previous findings are all nonsense 1. First, make sure that the folder (data) in the datadir in the my.ini file is not created manually [client] #Set the default character set of MySQL client default-character-set=utf8 [mysqld] #Set port to 3306 port=3306 #Set the installation directory of mysql basedir=F:\\MYSQL\\mysql-8.0.19-winx64\\mysql-8.0.19-winx64 #Set the storage location of the mysql database. You don't need to set datadir=F:\\MYSQL\\mysql-8.0.19-winx64\\mysql-8.0.19-winx64\\data #Maximum number of connections allowed max_connections=20 #The character set used by the server defaults to the 8-bit latin character set character-set-server=utf8 #The default storage engine used when creating a new table default-storage-engine=INNODB 2. Delete the data folder 3. Open cmd in administrator mode, enter the MySQL installation directory, and enter: sc delete mysql 4. Reinitialize the database (write down the password generated in this step, or you may forget it) mysqld --initialize --console 5. Reinstall MySQL mysqld install Then try again and see if it can be started. it's over? There is no next step to teach you how to change your password. There are a bunch of codes on the Internet. 6. Add the following line under mysqld in the my.ini file (skip password verification when logging in??? Oops, then all my steps above were... wasted): skip-grant-tables 7. After saving and exiting, retype mysql -uroot -p 8. At this point, you have entered the MySQL database. The next few steps are also set up successfully by me learning from others. You can use it yourself. Type in order: flush privileges; alter user 'root'@'localhost'IDENTIFIED BY 'the new password you want to set'; This will make the new password effective. But one thing to remember is to remove the line of code (skip-grant-tables) added to the ini file . Following the above 8 steps compiled by 123WORDPRESS.COM, you can completely solve the problem of forgetting the initial password. Thank you for learning. You may also be interested in:
|
<<: Example of how to quickly build a Redis cluster with Docker
>>: Detailed discussion of the differences between loops in JavaScript
When the scroll bar is pulled down, the floating ...
Table of contents Character Set Comparison Rules ...
Website administrators often accidentally delete ...
Preface NAT forwarding: Simply put, NAT is the us...
Preface In order to meet the high availability of...
Docker includes three basic concepts: Image: A Do...
Table of contents Step 1: Update Packages on Cent...
Table of contents MySQL inner join, left join, ri...
will-change tells the browser what changes will h...
Preface The delay of MySQL master-slave replicati...
Preface Named slots are bound to elements using t...
Table of contents In vue2 In vue3 Notes on setup ...
Table of contents 1 Introduction to user variable...
This article shares the specific code of Javascri...
There are two situations 1. Start time and end ti...