TiDBTiDB Docs Dash 2024

Jan 9 - Jan 12 (UTC)
Join us to improve docs and win a prize!
Sign InTry Free

USE

The USE statement selects a current database for the user session.

Synopsis

UseStmt:

UseStmt

DBName:

DBName

Examples

mysql> USE mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> SHOW TABLES; +-------------------------+ | Tables_in_mysql | +-------------------------+ | GLOBAL_VARIABLES | | bind_info | | columns_priv | | db | | default_roles | | expr_pushdown_blacklist | | gc_delete_range | | gc_delete_range_done | | global_priv | | help_topic | | opt_rule_blacklist | | role_edges | | stats_buckets | | stats_feedback | | stats_histograms | | stats_meta | | stats_top_n | | tables_priv | | tidb | | user | +-------------------------+ 20 rows in set (0.01 sec) mysql> CREATE DATABASE newtest; Query OK, 0 rows affected (0.10 sec) mysql> USE newtest; Database changed mysql> SHOW TABLES; Empty set (0.00 sec) mysql> CREATE TABLE t1 (a int); Query OK, 0 rows affected (0.10 sec) mysql> SHOW TABLES; +-------------------+ | Tables_in_newtest | +-------------------+ | t1 | +-------------------+ 1 row in set (0.00 sec)

MySQL compatibility

The USE statement in TiDB is fully compatible with MySQL. If you find any compatibility differences, report a bug.

See also

Was this page helpful?

Download PDFRequest docs changesAsk questions on Discord
Playground
New
One-stop & interactive experience of TiDB's capabilities WITHOUT registration.
Products
TiDB
TiDB Dedicated
TiDB Serverless
Pricing
Get Demo
Get Started
© 2024 PingCAP. All Rights Reserved.
Privacy Policy.