

In this tutorial, you have learned how to show all databases in the MySQL server using the SHOW DATABASES command or querying from the schemata table in the information_schema database. It returns the following result set: + -+ From the MySQL command-line client, you can simply type in the following command: mysql> create database mydatabase The MySQL command-line client is in. The following SELECT statement returns databases whose names end with 'schema' or 's'. If the condition in the LIKE clause is not sufficient, you can query the database information directly from the schemata table in the information_schema database.įor example, the following query returns the same result as the SHOW DATABASES command. MySQL is ideal for both small and large applications. Querying database data from information_schema Home Next MySQL is a widely used relational database management system (RDBMS).
#Mysql command full
It is important to note that if the MySQL database server started with -skip-show-database, you cannot use the SHOW DATABASES statement unless you have the SHOW DATABASES privilege. Even though there is no such command, users can use a MySQL query and get a full list of users in a given MySQL database server. See All SQL Examples MySQL Quiz Test Test your MySQL skills at W3Schools Start MySQL Quiz My Learning Track your progress with the free 'My Learning' program here at W3Schools.

If you want to query the database that matches a specific pattern, you use the LIKEclause as follows: SHOW DATABASES LIKE pattern įor example, the following statement returns database that ends with the string 'schema' SHOW DATABASES LIKE '%schema' Start the Exercise MySQL Examples Learn by examples This tutorial supplements all explanations with clarifying examples. The SHOW SCHEMAS command is a synonym for SHOW DATABASES, therefore the following command returns the same result as the one above: SHOW SCHEMAS Choose a method that best fits your configuration and follow the step-by-step instructions below. To list all databases on a MySQL server host, you use the SHOW DATABASES command as follows: SHOW DATABASES Ĭode language: SQL (Structured Query Language) ( sql )įor example, to list all database in the local MySQL database server, first login to the database server as follows: >mysql -u root -pĪnd then use the SHOW DATABASES command: mysql> SHOW DATABASES All methods provide ways to check the size for: A single database. Enter mysql. Summary: in this tutorial, you will learn how to use the MySQL SHOW DATABASES command to list all databases in a MySQL database server. First, start MySQL in Windows using the following command: mysql.exe -u username -p Replace username with the username for your MySQL installation.
