I started learning MySQL recently. The installation went smoothly and I was able to install it successfully by following the ready-made tutorials on the Internet. However, when entering mysql -uroot -p When I entered the password again, I encountered this situation
I have found many solutions online, but there is basically only one solution, which is to add the mysqld entry in the .ini file skip-grant-tables Then restart the server and follow the steps again (without entering the password at the end), but there is still a statement that stops me
I combined many methods on the Internet, tried them one by one, and finally succeeded. The overall idea is to modify the contents of the .ini configuration file, but it is modified through the command line. I don’t know if it is because the version iteration has blocked the previous method of directly modifying the file. In any case, it is possible to modify it through the command line on MySQL 8.0. Let’s get started. Open cmd as an administrator and switch to the bin directory of MySQL Shutdown the MySQL Server net stop mysql Skip the password input step (note: the file name and path must match your own) mysqld --defaults-file="D:\MySQL\my.ini" --console --skip-grant-tables If a statement similar to the one circled in the screenshot appears, it means success Restart the server net start mysql Log in to MySQL server mysql -uroot -p After entering the password, you can log in successfully. (The number 1 is very similar to the letter l) At this point, it's almost done, but when I type show databases; The feedback from MySQL is:
My guess is that MySQL thinks the random password provided during installation is insecure and asks the user to reset the password. I searched online and found a ready-made solution. Reference article: https://dev.mysql.com/doc/refman/5.7/en/alter-user.html Password never expires ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password' PASSWORD EXPIRE NEVER; Password has a limited time ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password' PASSWORD EXPIRE; Then log in to the server again and it will work normally. 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:
|
<<: JavaScript to achieve full or reverse selection effect in form
This article example shares the specific code of ...
Table of contents 1. Advantages of proxy vs. Obje...
How long has it been since I updated my column? H...
I won’t talk about the use of SSL certificates. F...
Introduction In a production environment, in orde...
There is no problem with the Dockerfile configura...
This article describes the MySQL user rights mana...
This article shares with you how to use Vue to im...
Preface Vue Router is the official routing manage...
Vim is a text editor that we use very often in Li...
I recently made a file system and found that ther...
Simply put, delayed replication is to set a fixed...
<body style="scroll:no"> <tabl...
Table of contents 1. Background: 2. Design ideas:...
Table of contents Vue2.x Usage Global Registratio...