将mysql的表导出到excel
用MYSQL语句:
mysql -uroot -p^^^^^ -e "select * from test.table2" > d:\a.xls
其中test为数据库 table2为其中的表 d:\a.xls为表位置
相关文档:
MySQL 字符串截取函数:left(), right(), substring(), substring_index()。还有 mid(), substr()。其中,mid(), substr() 等价于 substring() 函数,substring() 的功能非常强大和灵活。
1. 字符串截取:left(str, length)
mysql> select left('sqlstudy.com', 3);+-------------------------+| left('sqlstudy.com', 3) | ......
还原一个数据库:mysql -h localhost -u root -p123456 www<c:\www.sql
备份一个数据库:mysqldump -h localhost -u root -p123456 www > d:\www2008-2-26.sql
//以下是在程序中进行测试
//$command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile";
$command="mysqldum ......
E:\databases\MySQL\MySQL Server 5.1\bin>mysqldump --help
mysqldump Ver 10.13 Distrib 5.1.30, for Win32 (ia32)
By Igor Romanenko, Monty, Jani & Sinisa
This software comes with ABSOLUTELY NO WARRANTY. This is free softwa
and you are welcome to modify and redistribute it under the GPL ......
我的环境:
原有一mysql5.0实例,现新安装一mysql5.1,并将新的5.1实例的数据路径放在另一目录。
mysql5.1的my.ini如下
(配置my.ini的参考资料:
http://dev.mysql.com/doc/refman/5.1/en/option-files.html
http://downloads.mysql.com/docs/mysql-windows-excerpt-5.1-en.pdf
http://dev.mysql.com/doc/refman/5.0 ......