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!

Jul 172011
 

How to change the MySQL temporary directory

Answer:

To change the temporary directory of your MySQL server to use a non-default directory, you can change the tmpdir parameter in your my.cnf

..
tmpdir = /data/tmp
..

Don't forget to change the permission of that temporary directory

# sudo chmod mysql:mysql /data/tmp

Then restart MySQL to take effect.

# /sbin/service mysqld restart

Jul 132011
 

Alter all tables in MySQL

Answer:

To alter all the tables in a given database in MySQL, e.g. change the storage engine, you can first generate the SQL statements using following method.

mysql> select CONCAT("Alter Table `", TABLE_SCHEMA,"`.`", TABLE_NAME, "` ENGINE = InnoDB") AS cmd from TABLES where TABLE_SCHEMA = "test";

It will print out the followings:

+----------------------------------------------------------------+
| cmd                                                            |
+----------------------------------------------------------------+
| Alter Table `test`.`foo`  ENGINE = InnoDB                      | 
| Alter Table `test`.`bar`  ENGINE = InnoDB                      | 
...

Then you can execute the above commands manually.

Jul 112011
 

Remove added files using svn add

Answer:

To remove files from committed into the SVN in the next commit if you have just added them using the svn add, you should use svn revert

e.g.

# svn revert file.txt