- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
List down all the Tables in a MySQL Database
Let us understand how to list down all the tables in a MySQL database −
Once a database is created, we can access and use a specific database, using the following query −
mysql> USE databaseName Database changed
The ‘USE’ statement doesn’t require a semi-colon. This is similar to the ‘QUIT’ statement. Even if semi-colon is used, it does no harm. We can create and use a database of our own, but before that, MySQL administrator’s permission is required.
The MySQL administrator can execute a command as shown below to provide permissions −
mysql> GRANT ALL ON tableName.* TO ‘your_mysql_name’@’your_client_host’;
Here, ‘your_mysql_name’ refers to the MySQL user name which is assigned to the user.
The ‘your_client_host’ refers to the host from which the user connected to the server.
The below query displays the tables in the database −
mysql> SHOW TABLES;
Note: If the database was newly created, it is obvious that there would be no tables in it. The above query would result in an ‘empty set’. One of the most important part is to decide the structure of the database, the tables that would be needed, the columns in every table and the relationship between these tables.
Once we decide what our database needs to contain, a proper name for it, and tables have been created with proper column names and row values, we can discuss what kind of manipulations can be performed with this database.
- Related Articles
- How to List All Tables in a Schema in Oracle Database?
- Display all tables inside a MySQL database using Java?
- Get record count for all tables in MySQL database?
- How to get the list of tables in default MySQL database?
- Get a list of non-empty tables in a particular MySQL database?
- How to list all triggers in a MySQL database?
- How can I describe all tables in the database through a single statement in MySQL?
- How to list down all the running queries in MySQL?
- Find a specific column in all the tables in a database?
- While connecting to one MySQL database, how can I see the list of tables of other MySQL database?
- How can we check the character set of all the tables in a particular MySQL database?
- Get all the tables from a MySQL database having a specific column, let’s say xyz?
- List of non-empty tables in all your MySQL databases?
- How can I display all databases in MySQL and for each database show all tables?
- How to show all the tables present in the database and server in MySQL using Python?