2009年1月4日 星期日

mysql export 的預設目錄

mysql> select * from table1 where field1='tgtfield' into outfile 'dataOut.txt';
'dataOut.txt' 預設放在 MySQL data 目錄下,
i.e. /var/lib/mysql/databasename/


[ref]
http://www.learn-mysql-tutorial.com/ExportImport.cfm

如何將mysql table export 到xml file?

[Q] 如何將mysql table export 到xml file?

[try]
0. 在啟動 mysql client 需要enable --xml 選項
./mysql -ujon test --xml -e 'SELECT * FROM t1' > t1.xml

1. use php to fetch data and format the output



[ref]
http://dev.mysql.com/doc/refman/5.1/en/mysql-command-options.html#option_mysql_xml
http://forums.mysql.com/read.php?44,59164,161365#msg-161365

如何在 mysql client 內 執行linux shell 命令?

[Q] 如何在 mysql client 內 執行linux shell 命令?
[Q] How to execute shell commands from within the MySQL command line client?

[sol] mysql> \! ls -l

[ref]
http://www.electrictoolbox.com/shell-commands-mysql-command-line-client/