当前位置:网站首页>Three minutes to learn how to retrieve the MySQL password

Three minutes to learn how to retrieve the MySQL password

2022-06-23 16:37:00 User 7353950

One 、 In the test work, we will definitely write some sq The query statement is convenient for us to verify whether the data is correct , So as to judge whether the current software has defects , But in the process of query, we must connect to the database first , If the database password is forgotten, we cannot complete the work , Here I will teach you how to change your password quickly , And resetting the database password , This greatly improves the efficiency of our work

Two 、 First we need to learn how to modify mysql Data password , Here it is navicat To connect to the database, which is also the most commonly used software

• To open the first navicat As shown in the following figure, first find the location where your password is stored , Stored in the warehouse of the factory mysql Find the best one in the table under the file directory user This is used to store the database password , The corresponding user name and password

• Then click the query button to create a new query method , Corresponding to our modification mysql The password is to write a sql The statement is as follows

update user set password=password('123') where user='root';

flush privileges; You need to refresh permissions to make the modification effective

• This is the successful modification mysql And then restart it in the local service mysql service , Direct closure navicat When you open it again, the connection to the database will fail, indicating that the database connection failed , Just re edit and input the modified password, as shown in the figure

3、 ... and 、 The above is how to change the password , If one day you forget your password, you don't have to uninstall the database and reinstall it , The following shows how to reset the data password

• First, find the location where the database is installed my.int The file of (C:Program Files (x86)MySQLMySQL Server 5.1) Address location as shown in the figure below

• Open the file with notepad and find [mysqld] This line adds the following code below This allows you to log in to the database without a password skip-grant-tables Then save and refresh again mysql The service can successfully connect without a password .

• After successful login, you can reset the new password according to the above operation of changing the password

• update user set password=password('123') where user='root';

flush privileges; You need to refresh permissions to make the modification effective

such password Just remember the new password and forget it later. Don't worry about uninstalling and reinstalling the software .

原网站

版权声明
本文为[User 7353950]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/174/202206231553183425.html

随机推荐