MySQL Commands

From TheBestLinux.com
Revision as of 15:30, 9 June 2013 by Jamie (talk | contribs) (Created page with "== Miscellanious MySQL Query Commands == * Login into a MySQL database server from the Linux command line with a user name and have it prompt for the password: <pre style="color:...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Miscellanious MySQL Query Commands

  • Login into a MySQL database server from the Linux command line with a user name and have it prompt for the password:
$ mysql -p


  • Display all available datases:
mysql> show databases;


  • Select a database(where database_name is the name of the database you want to use):
mysql> use database_name;


  • Display all tables in a database which has been selected:
mysql> show tables;


  • Dislpay all data in a specific table(where table_name is the name of the table you want to use):
mysql> select * from table_name;


  • Display the number of rows in a specifi table(where table_name is the name of the table you want to count the rows):
mysql select count(*) from table_name;