Tuesday, November 1, 2011

How delete all data from MySQL table

There are two ways to delete all the data in a MySQL database table.

TRUNCATE TABLE tablename; This will delete all data in the table very quickly. In MySQL the table is actually dropped and recreated, hence the speed of the query. The number of deleted rows for MyISAM tables returned is zero; for INNODB it returns the actual number deleted.

DELETE FROM tablename; This also deletes all the data in the table, but is not as quick as using the "TRUNCATE TABLE" method. In MySQL >= 4.0 the number of rows deleted is returned; in MySQL 3.23 the number returned is always zero.

Read more about it in this post:

How to list all tables in MySQL

If you want to see all tables created in your DataBase list them using this commands:

1. Enter to your DB
mysql db; (where db is the name for your DataBase)

2. Type
show tables;

How to reorder or rename logical interface names in Linux

Here is the link where you can read about this topic.
http://www.science.uva.nl/research/air/wiki/LogicalInterfaceNames

How to change permission in Linux

If you want to change the permission for some files or directories in Linux do this:


sudo -s
cd /dir1
find dir1/ -type f -perm 555 (if you just want to see that files)

find dir1/ -type f -perm 555 -exec chmod 644 {} \;
find dir1/ -type d -perm 555 -exec chmod 755 {} \;
ls -l