Home  >  Article  >  Database  >  How to query all tables in mysql

How to query all tables in mysql

青灯夜游
青灯夜游Original
2022-06-20 16:43:0226951browse

How to query all tables in the mysql database: 1. Execute the "mysql -u root -p" command and enter the password to log in to the mysql database server; 2. Execute the "USE database name;" command to switch to the specified Database; 3. Execute the "show tables;" or "SHOW FULL TABLES;" command to list all tables in the mysql database in table form.

How to query all tables in mysql

The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.

In mysql, you can use the SHOW TABLES statement to query all tables in the database; this statement lists all tables in the MySQL database.

Query steps:

1. Execute the following command to log in to the mysql database server

mysql -u root -p

How to query all tables in mysql

2. Switch to the specified database (mydb):

USE mydb;

How to query all tables in mysql

3. List all tables in the mydb database:

show tables;

How to query all tables in mysql

You can see that there are 4 tables in the mydb database: contacts, mip_demo, tb_dept, users

The SHOW TABLES command can display the tables Base table or view. To include the table type in the results, use the SHOW FULL TABLES statement as shown below -

How to query all tables in mysql

[Related recommendations: mysql video tutorial

The above is the detailed content of How to query all tables in mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn