MySQL database has a database named MySQL;
Yes, it's a bit of a detour, and it's understandable to read it more than two times.
The execution show tables; can be found to have so 28 tables under it;
mysql> use MySQL;
Database changed
Mysql> Show tables;
+---------------------------+
| Tables_in_mysql |
+---------------------------+
| Columns_priv |
| db |
| Event |
| Func |
| General_log |
| Help_category |
| Help_keyword |
| help_relation |
| Help_topic |
| Innodb_index_stats |
| Innodb_table_stats |
| Ndb_binlog_index |
| Plugin |
| Proc |
| Procs_priv |
| Proxies_priv |
| Servers |
| Slave_master_info |
| Slave_relay_log_info |
| Slave_worker_info |
| Slow_log |
| Tables_priv |
| Time_zone |
| Time_zone_leap_second |
| Time_zone_name |
| time_zone_transition |
| Time_zone_transition_type |
| user |
+---------------------------+
Rows in Set
You can skip the previous 27 sheets and see the last one directly;
The user table records the data of users who log in to MySQL;
We change the user's login password is actually to change the data in the Users table;
The following example is to change the root password to Baijunyaoboke;
mysql> use MySQL;
Database changed
mysql> Update user Set password = password ("Baijunyaoboke") Where user = "root";
Query OK, 3 rows affected
Rows Matched:3 Changed:3 warnings:0
Query OK, 3 rows affected
mysql> flush Privileges;
Query OK, 0 rows affected
After the change, remember to flush privileges; refresh the system permissions related tables;
Finally, one thing is emphasized with the history of blood and tears. Do not use this method to modify the password in the Wampserver environment;
Otherwise, in addition to reloading Wampserver, temporarily did not find a solution to change the password error after the problem;
Modify the MySQL password