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
Nowadays, whether you are on the sofa at home or ...
Table of contents Preface 1. Introduction to Axio...
After installing wamp for the first time, all ser...
Preface Today, when I was using a self-written co...
The reason why Docker is so popular nowadays is m...
Table of contents 1. Scopes are expressed in diff...
Replication is to transfer the DDL and DML operat...
Six effectsImplementation Code html <h1>CSS...
The LIKE operator is used in the WHERE clause to ...
First of all, this post is dedicated to Docker no...
Original link https://github.com/XboxYan/no… A bu...
1. Preparation Middleware: Tomcat, Redis, Nginx J...
For a website, usability refers to whether users c...
Zabbix server environment platform ZABBIX version...
Problem Description After installing the plugin E...