Results 1 to 2 of 2
I install Putty that I export SQL base. I can log in on server with Putty. I don't know the write commands that I export my SQL base on server ...
- 11-02-2008 #1Just Joined!
- Join Date
- Nov 2008
- Posts
- 1
Export SQL base with Putty
I install Putty that I export SQL base. I can log in on server with Putty. I don't know the write commands that I export my SQL base on server for back up. Which commands must I write in Putty for this purpose or where can I see these commands. Thank you for your help.
- 11-02-2008 #2Just Joined!
- Join Date
- Nov 2008
- Posts
- 3
Exporting Data with the SELECT ... INTO OUTFILE Statement
1. Login to server through putty
2. Login to mysql Server: mysql -u root -p
Type your password:
3. Export data to text format using command:
SELECT * FROM [TableName] INTO OUTFILE '/path/filename.txt'
ex: mysql> SELECT * FROM test INTO OUTFILE '/tmp/test.text'
----> done
Export data to csv format using command:
SELECT * FROM [TableName] INTO OUTFILE '/path/filename.txt'
-> FIELDS TERMINATED BY ',' ENCLOSED BY '""'
-> LINES TERMINATED BY '\r\n';
Remember: statement one line.
ex: mysql> SELECT * FROM test INTO OUTFILE '/tmp/test.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '""' LINES TERMINATED BY '\r\n';
----------> done
If you want export data as RAW data
The mysqldump program is used to copy or back up tables and databases. It can write table output either as a raw datafile, or as a set of INSERT statements that recreate the records in the table.
To dump a table as a datafile, you must specify a --tab option that indicates the directory where you want the MySQL server to write the file.
For example, to dump the test_tbl table from the Test database to a file in the /tmp directory, use a command like this:
mysqldump -u root -p --no-create-info \
--tab=/tmp Test test_tbl
password ******
Exporting Table Contents or Definitions in SQL Format:
mysqldump -u root -p Test test_tbl > dump.txt
password ******
Backup all database on Mysql using:
mysqldump - u root -p --all-database > dump.txt
password ******


Reply With Quote