How to get the storage path of TiDB through SQL commands?

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

Original topic: 各位大哥怎么通过sql命令获取TiDB的存储路径啊

| username: TiDB超级萌新

How can I get the storage path of TiDB through SQL commands?

| username: Kongdom | Original post link

Do you mean this?

SELECT * FROM INFORMATION_SCHEMA.CLUSTER_CONFIG 
WHERE (`KEY` LIKE '%dir%' OR `KEY` LIKE '%path%')
AND VALUE != ''
| username: TiDB超级萌新 | Original post link

It is set in the configuration file.

| username: TiDB超级萌新 | Original post link

This value

| username: Kongdom | Original post link

Here it is:

SELECT * FROM INFORMATION_SCHEMA.CLUSTER_CONFIG 
WHERE `KEY` LIKE '%data-dir%'
| username: Miracle | Original post link

show config where name like ‘%data-dir%’;

| username: TiDB超级萌新 | Original post link

Got it, thanks!

| username: Kongdom | Original post link

:handshake: :handshake: :handshake:

| username: FutureDB | Original post link

Just learned about the CLUSTER_CONFIG table today, and now I see its specific usage. Awesome!

| username: Jellybean | Original post link

You can also use the SHOW CONFIG command to obtain it. For example:

SHOW CONFIG LIKE 'tidb';
SHOW CONFIG WHERE type = 'tidb' AND name = 'advertise-address';

The entire statement is used to display the current configuration being applied by each component of TiDB.

However, note that configurations and system variables operate at different dimensions.

| username: TiDB超级萌新 | Original post link

Hahaha, let’s learn together, let’s learn together :palm_down_hand:

| username: dba远航 | Original post link

SELECT * FROM INFORMATION_SCHEMA.CLUSTER_CONFIG WHERE KEY LIKE ‘%data-dir%’;

| username: Kongdom | Original post link

As a programmer, I prefer using the cluster_config table. The syntax for show config is not very useful.

| username: kelvin | Original post link

You can look at the configuration file or the SQL statements.

| username: wangccsy | Original post link

Learned something new.

| username: TIDB-Learner | Original post link

:100: :100: :100:

| username: 麻烦是朋友 | Original post link

Let’s learn together.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.