Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Linux Ask!

Oct 092010
 

Drop a database in MongoDB

Answer:

Assuming you are going to drop the `test` database in MongoDB, follow the steps below to drop (delete) it.

>  use test
switched to db test

> db.dropDatabase()
{ "dropped" : "test.$cmd", "ok" : 1 }
Oct 082010
 

Set the maximum execution time in PHP

Answer:

The default maximum execution time in PHP is 30 seconds. If you want to change it, you need to edit the php.ini

vi /etc/php.ini

Locate and set

max_execution_time = 120;

Try it with the number you need.

Also, remember to restart web server such as Apache if needed.

Oct 062010
 

Show all tables started with a prefix in MySQL

Answer:

If your database has a lot of tables, and you want to list all the tables started with a name prefix, you can try:

mysql> SHOW TABLES LIKE 'cache%';
+--------------------------------+
| Tables_in_mydb (cache%) |
+--------------------------------+
| cache                          |
| cache_block                    |
| cache_bootstrap                |
| cache_field                    |
| cache_filter                   |
| cache_form                     |
| cache_image                    |
| cache_menu                     |
| cache_page                     |
| cache_path                     |
| cache_update                   |
+--------------------------------+
11 rows in set (0.00 sec)