How to Show All Tables in MySQL using Python? Last Updated : 29 Sep, 2021 Comments Improve Suggest changes Like Article Like Report A connector is employed when we have to use mysql with other programming languages. The work of mysql-connector is to provide access to MySQL Driver to the required language. Thus, it generates a connection between the programming language and the MySQL Server. In order to make python interact with the MySQL database, we use Python-MySQL-Connector. Here we will try implementing SQL queries which will show the names of all the tables present in the database or server. Syntax: To show the name of tables present inside a database: SHOW Tables; To show the name of tables present inside a server: SELECT table_name FROM information_schema.tables; Database in use: Schema of the database used The following programs implement the same. Example 1: Display table names present inside a database: Python3 import mysql.connector mydb = mysql.connector.connect( host="localhost", user="root", password="", database="gfg" ) mycursor = mydb.cursor() mycursor.execute("Show tables;") myresult = mycursor.fetchall() for x in myresult: print(x) Output: Table names in gfg database Example 2: Display table names present inside a server: Python3 import mysql.connector mydb = mysql.connector.connect( host="localhost", user="root", password="", ) mycursor = mydb.cursor() mycursor.execute("SELECT table_name FROM information_schema.tables;") myresult = mycursor.fetchall() for x in myresult: print(x) Output: Table names in server Comment More infoAdvertise with us Next Article How to Show All Tables in MySQL using Python? S Soham_Lanke Follow Improve Article Tags : Python Python-mySQL Practice Tags : python Similar Reads How to Copy a Table in MySQL Using Python? In this article, we will create a table in MySQL and will create a copy of that table using Python. We will copy the entire table, including all the columns and the definition of the columns, as well as all rows of data in the table. To connect to MySQL database using python, we need PyMySql module. 3 min read How to list tables using SQLite3 in Python ? In this article, we will discuss how to list all the tables in the SQLite database using Python. Here, we will use the already created database table from SQLite. We will also learn exception handling during connecting to our database. Database Used:  Steps to Fetch all tables using SQLite3 in Pytho 2 min read How to Copy a Table Definition in MySQL Using Python? Python requires an interface to access a database server. Python supports a wide range of interfaces to interact with various databases. To communicate with a MySQL database, MySQL Connector Python module, an API written purely in Python, is used. This module is self-sufficient meaning that it does 6 min read How to Print Out All Rows of a MySQL Table in Python? MySQL server is an open-source relational database management system which is a major support for web-based applications. Databases and related tables are the main component of many websites and applications as the data is stored and exchanged over the web.  In order to access MySQL databases from a 2 min read How to Add a Column to a MySQL Table in Python? Prerequisite: Python: MySQL Create Table Python allows the integration of a wide range of database servers with applications. A database interface is required to access a database from Python. MySQL Connector-Python module is an API in python for communicating with a MySQL database.  ALTER statemen 4 min read How to Show/List Tables in MySQL Database In MySQL, the SHOW TABLES command is a powerful tool used to list the tables within a specific database. This command provides a convenient way to view the tables that exist in a database without needing to query the database schema directly. In this article, we are going to explore various ways whe 5 min read Python MariaDB - Drop Table using PyMySQL MariaDB is an open source Database Management System and its predecessor to MySQL. The pymysql client can be used to interact with MariaDB similar to that of MySQL using Python. In this article we will look into the process of Dropping a table from a database using pymysql. To drop a table use any o 2 min read Add comment to column in MySQL using Python MySQL server is an open-source relational database management system which is a major support for web-based applications. Databases and related tables are the main component of many websites and applications as the data is stored and exchanged over the web. In order to access MySQL databases from a 3 min read How to List All Tables in Oracle? In this article, we will discuss all the methods to list all tables in the oracle SQL Database. We have three types of a subset of tables available to use as identifiers which in turn help us to sort the required table names. Here, are the following types of table identifiers in the Oracle SQL Datab 2 min read How to Show all Columns in the SQLite Database using Python ? In this article, we will discuss how we can show all columns of a table in the SQLite database from Python using the sqlite3 module. Approach:Connect to a database using the connect() method.Create a cursor object and use that cursor object created to execute queries in order to create a table and 3 min read Like