In the previous article, we introduced how to forget the root password in MySQL 5.7 and how to modify the root password in MySQL 5.7 A quick and simple solution to forget the password of Mysql5.7. The specific method details are as follows: # The simplest and most brutal way is to find the mysql configuration file and edit it directly with vim /etc/my.cnf # Add a line in [mysqld] to skip the permission restriction skip-grant-tables # Save and exit to restart the mysql service service mysqld restart # User login mysql -uroot -p (click Enter directly, the password is empty) # Select database use mysql; # But the password field does not exist in version 5.7, so we need to use the following modification to reset the password update user set authentication_string=password('new password') where user='root'; #Flush privileges; # Exit mysql quit; # Delete skip-grant-tables in the configuration file my.cnf that was modified at the beginning and restart mysql service mysqld restart # After you log in to MySQL, you will find that when you execute the command, ERROR 1820 (HY000) will appear: You must reset your password using ALTER USER statement; # This is a reminder that you need to change the password when you execute SET PASSWORD = PASSWORD('root'); # If ERROR 1819 (HY000): Your password does not satisfy the current policy requirements # You need to execute two parameters to cancel the default password strength of MySQL. Of course, you can also increase the complexity of your password. set global validate_password_policy=0; set global validate_password_mixed_case_count=2; # Now you can execute it again and it will be ok SET PASSWORD = PASSWORD('root'); # Let's talk about the character set problem in MySQL show variables like "%character%"; # The following situations can be ignored... +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ #Find the mysql configuration file and add a few words to it. Add character-set-server=utf8 under mysqld collation-server=utf8_general_ci # Add default-character-set=utf8 under client The above is what I introduced to you about what to do if you forget the root password of Mysql5.7 (a simple and effective method). I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: How to reset the root password in CentOS7
>>: JS implements simple calendar effect
Preface Before talking about covering index, we m...
Reflections on the two viewpoints of “people-orie...
Using DOSBox, you can simulate DOS under Windows ...
I've been using Bootstrap to develop a websit...
MyISAM storage engine MyISAM is based on the ISAM...
<br />How to remove the dividing lines of a ...
Project requirements: When you click a product tr...
This article example shares the specific code of ...
Table of contents Special characters in URLs URL ...
Preface Backup is the basis of disaster recovery....
Whether MySQL needs to commit when performing ope...
Table of contents From father to son From son to ...
<br />The following are the problems I encou...
The storage size and range of each floating point...
The Docker container provides services and listen...