After mysql use db, it is very difficult to solve a mysql instance that you usually use. After using db, it is always very difficult to press Enter. It takes 1 s to return the result. I think there is something strange, I opened the general log and found that the simple use test, mysql actually executed a lot of content: SQL code 130603 16:02:11 2 Query SELECT DATABASE () 2 Init DB test 2 Query show databases 2 Query show tables 2 Field List B 2 Field List bmw 2 Field List http_auth 2 Field List perf_machine 2 Field List t 2 Field List t1 2 Field List t2 2 Field List t5 2 Field List t_max_col 2 Field List tb 2 Field List tbcsv 2 Field List tbmemory 2 Field List tbmyi Sam 2 Field List tc 2 Field List total 2 Field List tt simple show tables, show databases, select database (), show tables from test, actually all correspond to only one generallog. SQL code 130603 16:17:12 2 Query show tables 130603 16:17:28 2 Query show databases 130603 16:17:48 2 Query SELECT DATABASE () 130603 16:19:44 3 Query show tables from test you can see a use test from the general log, the dispatch_command () is actually executed multiple times, and the breakpoint is set for general_log_write () using gdb. The actual execution is as follows: COM_QUERY. The corresponding SQL is SELECT DATABASE (), and the call path is: handle_one_connection (SQL _connect.cc)-> do_command (SQL _parse.cc)-> dispatch_command (SQL _parse.cc, co Mmand = COM_QUERY, packet = "select database ()"); invocation, call path: handle_one_connection (SQL _connect.cc)-> do_command (SQL _parse.cc)-> dispatch_command (SQL _parse.cc, command = Hangzhou, packet = "test"); COM_QUERY, the corresponding SQL is show databases, the call path is: handle_one_connection (SQL _connect.cc)-> do_command (SQL _parse.cc)-> dispatch_command (response, command = COM_QUERY, packet = "show databases"); COM_QUERY, the corresponding SQL is show tables, Call path: handle_one_connection (SQL _connect.cc)-> do_command (SQL _parse.cc)-> dispatch_command (response, command = COM_QUERY, packet = "show tables"); COM_FIELD_LIST, call path: handle_one_connection (SQL _connect.cc)-> do_command (SQL _parse.cc)-> dispatch_command (SQL _parse.cc, command = COM_FIELD_LIST, packet = "columns_priv "). Here is n calls (n is the number of tables under the schema in use, and the pachet content is the table name at each call ); therefore, when there are many tables under the schema of use, it will naturally become a bit stuck (for the same schema of continuous use, the second use, only the COM_QUERY and COM_INIT_DB processes will be available.) to avoid using the db. add no-auto-rehash to cnf, or add the-A option when connecting to mysql client.