Some Databases in the mysql.db Table of TiDB Cannot Be Found

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tidb的mysql.db表有部分库查不到

| username: 特雷西-迈克-格雷迪

[TiDB Usage Environment] Production Environment / Testing
[TiDB Version] v6.1.7
[Reproduction Path]
CREATE DATABASE gta_auths /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */;

[Encountered Problem: Phenomenon and Impact]
After creating the database gta_auths, it appears when using “show databases;”, but does not appear when using “select * from mysql.db;”.

[Resource Configuration] Enter TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachments: Screenshots/Logs/Monitoring]

| username: mono | Original post link

Other system tables also have inaccurate data, such as cluster parameter configurations, etc. But it does not affect usage. Use show databases; to check. This is accurate.

| username: mono | Original post link

Additionally, I remember MySQL also has this issue. If you don’t believe me, you can try it out!

| username: 特雷西-迈克-格雷迪 | Original post link

How amazing, as long as it doesn’t affect usage, it’s fine. Thank you, expert.

| username: 这里介绍不了我 | Original post link

Wait a bit and check again, it should be there.

| username: 特雷西-迈克-格雷迪 | Original post link

Indeed, the data in this table is also very messy and incomplete in MySQL.

| username: mono | Original post link

This is normal. It records permissions. I guess what you need to check is the information_schema.SCHEMATA view. Try it and see.

| username: DBAER | Original post link

This table records database-level permissions.

The SQL statement grant select test2.* from test; is considered to persist this SQL.

Check again:

select * from mysql.db\G
*************************** 1. row ***************************
                 Host: %
                   DB: test2
                 User: test
          Select_priv: Y
          Insert_priv: N
          Update_priv: N
          Delete_priv: N
          Create_priv: N
            Drop_priv: N
           Grant_priv: N
      References_priv: N
           Index_priv: N
           Alter_priv: N
Create_tmp_table_priv: N
     Lock_tables_priv: N
     Create_view_priv: N
       Show_view_priv: N
| username: tidb菜鸟一只 | Original post link

Check again after granting permissions.

| username: 啦啦啦啦啦 | Original post link

To display it, you need to grant the gta_auths database permissions to a specific user. If all permissions are granted to ., then this table will be empty.

| username: 呢莫不爱吃鱼 | Original post link

Got it, I never quite understood what was going on before.

| username: 健康的腰间盘 | Original post link

Take a look at ROOT

| username: 小于同学 | Original post link

Are there any bugs?

| username: yytest | Original post link

It should be a permissions setting issue.