//=== http://stackoverflow.com/questions/8603182/how-to-update-table-if-table-exists-with-mysql-dump
mysqldump -uadmin -p > dump.sql
DROP TABLE IF EXISTS `employees`;
CREATE TABLE `employees` (
`major` int(11) NOT NULL DEFAULT '0',
...
)
how to change it to
IF TABLE EXISTS, UPDATE IT ???
//=== http://stackoverflow.com/questions/2220469/create-table-if-not-exists-from-mysqldump
* first dump containing table definitions (--no-data --skip-add-drop-table)
* second dump with only data (--no-create-info --skip-add-drop-table)
$ sed -i 's/CREATE TABLE/CREATE TABLE IF NOT EXISTS/g' dump_schema.sql
沒有留言:
張貼留言