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"
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop












{ 38 comments… read them below or add one }
gud site for learn
you can use the -e option to execute some queries on the command line, EG, to list databases:
mysql -e “show databases” -u -p
Nice tips, very helpful.
Thanks
how can i know if there is a database server on my pc?
i tried this command:
-e “show databases” -u -p
and i got this error:
ERROR 2006 (HYOOO):MySQL server has gone away
No connection. Trying to reconnect. . .
Connection id: 19
Current database: TCPDUMP
ERROR 1064 (42000): You have and error in your SQL syntax;check the manual to your corresponds to your MySQL server version for the right syntax to use near ‘-e “show databases” -u -p’ at line 1
can anyone help me?
In this above error indicates Mysql error state.so ,u can check to identify correcly connections are established or not,and once u check your transcational data.
Hi lady,
I suppose you are using …. Linux? or Windows? if you are using Windows, just go to your control panel and check in “Add/Remove Programs” if you see something like “mysql”. Also you can check in services under Administrative tools.
Now, if you are in Linux,
type “mysql” and then press “TAB” twice and you will see a list of commands like:
mysql mysqlimport
mysqlaccess mysql_install_db
mysqladmin mysqlmanager
…
then mysql is installed. To know if it is running:
nmap localhost
and you will see a “3306/tcp open mysql”.
Also, if you copy+paste some codes or example from web pages remember that sometimes the quotation mark is changed (looks similar but they are not)
I hope this is helpful
Very helpful tips, thanks
Another question, man.
How can I delete a database or table under a database such as TEST?
i m new to mysql and when i m trying to mysqlcheck -u root –analyze mysql then i m getting error ERROR 1064(42000). is there anybody who will help me to solve this problem? Please help me at the earliest.
How to setup a working database named ‘RCC’ in a new server. Please send me ur commands
thank you so much really beneficial.
Its nice to learn
At present i am working in one database . i want to know current working database name.give command plz.
Hi
@jeevan use
SELECT DATABASE();
Paul
Or just do: mysql_show -u yourusername -p
sorry that should be: mysqlshow -u yourusernamehere -p (so without underscore)
i am new in mysql. i tried to connection to mysql through php. i think problem in mysql server.
i am use window base, xampp server for this. how to find out my server name, database name,username and password. when u use with servername with localhost they are not running
successfully. i tried for this. i doing this activity last 2 days. but i am fail in this. so u advice me
for above. i want to connect mysql to php. if u can example then best.
This error comes when you write
# mysql
ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: NO)
plz help
Nice flow defined.
Hello
When you do the command SHOW DATABASE, i would like to know which condition is used for the sort of the output of this command ?
how to import database through command line in mysql if sql file is store in other drive
Loading your data from a file. ( for windows )
mysql> source ‘enter file name with including path’ ;
eg: mysql> source d:/world.sql ; ( use forwards slash )
Very good way to display all databases. Now I know I have lot of test databases on my server.
Nice Tutor,,
how to create a simple databases bro ?
very good
its very nice
ya nice 2 learn….
its very nice and simple problem are solve
i’m try to put mysql syntax but it is still error 1064 i dont know why?
Is write a message You have ana error in your sql syntax; check the manual corresponds to your Mysql server version for the right syntax to use near ‘database’ line 1
Cool !!
it makes learning easy :)
how to solve problem MySQL database with j boss AS 7 to Linux OS
The results which I am getting after executing a query are too messed-up. How do I outline it in a readable or may be in a clear view, I mean in a table format?
helped a lot.
thanks for helping.
mysql> use mysql;
ERROR 1044 (42000): Access denied for user ”@’localhost’ to database ‘mysql’
mysql> mysql –user=mlpc4 –password=mlpc4
-> i got this error smbdy plz hlp me..
You haven’t a permission to use this database
good, very usefull
really very useful content