Posted: . At: 9:30 PM. This was 12 years ago. Post ID: 4513
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.

More MySQL tips. Listing databases and viewing the MySQL version.

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)

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.