How to list tables in a MySQL database.
mysql> show tables in acme; +----------------+ | Tables_in_acme | +----------------+ | address | | customer | | discount | | order_header | | order_line | | order_shipment | | payment_terms | | phone | | product | | reseller | | salesman | | shipment | | status | +----------------+ 13 rows in set (0.00 sec) |
Search the database and then return a count of all rows that contain a certain phrase or word.
mysql> SELECT count(*) post_content FROM wp_makronposts WHERE post_content REGEXP 'linux kernel 2.35'; +--------------+ | post_content | +--------------+ | 6 | +--------------+ 1 row in set (0.12 sec) |
Listing the databases in your MySQL installation.
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | acme | | fun | | mysql | | performance_schema | | test | +--------------------+ 6 rows in set (0.00 sec) mysql> |
Search a database to find certain text.
mysql> select * from wp_makronposts where post_content rlike "_configure"; |
How to get the MySQL version with SQL.
mysql> select @@version; +-------------------------+ | @@version | +-------------------------+ | 5.5.24-0ubuntu0.12.04.1 | +-------------------------+ 1 row in set (0.00 sec) |