MySQL command to show list of databases on server
Q. I am new to MySQL database server. How do I show the list of databases on my server? Is there any good GUI frontend exists for the same?
A. You can use mysql command to connect to mysql server and list available databases.
Task: Mysql list databases
mysql is a simple command-line tool. mysql is command line and it is very easy to use. Invoke it from the prompt of your command interpreter as follows:
$ mysql
Output:
mysql>
You may need to provide mysql username, password and hostname, use:
$ mysql --user=your-user-name --password=your-password
mysql>
To list database type the following command
mysql> show databases;
Output:
+--------------------+ | Database | +--------------------+ | information_schema | | mysql | +--------------------+ 2 rows in set (0.00 sec)
information_schema and mysql are name of databases. To use these database and to list available tables type the following two commands:
mysql> use mysql;Output:
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
Now list tables:
mysql> show tables;Output:
+---------------------------+ | Tables_in_mysql | +---------------------------+ | columns_priv | | db | | func | | help_category | | help_keyword | | help_relation | | help_topic | | host | | proc | | procs_priv | | tables_priv | | time_zone | | time_zone_leap_second | | time_zone_name | | time_zone_transition | | time_zone_transition_type | | user | +---------------------------+ 17 rows in set (0.00 sec) mysql>
GUI tools
Since you are new to MySQL, it is better to use GUI tools. Please refer previous article about "GUI Tools for managing MySQL databases server"
Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
Related Other Helpful FAQs:
- MySQL List Databases
- GUI Tools for managing MySQL databases server
- MySQL Run SQL Queries From A Shell Prompt / Command Line
- Ubuntu Linux Backup MySQL server Shell Script
- MySQL server status with mysqlreport report script
Discussion on This FAQ
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: column names, command interpreter, command line tool, database server, database type, gui frontend, mysql command, mysql databases, mysql gui tools, output database, output tables, reading table, schema, transition time, zone time



March 5th, 2008 at 9:44 am
gud site for learn
March 25th, 2008 at 3:23 am
you can use the -e option to execute some queries on the command line, EG, to list databases:
mysql -e “show databases” -u -p