如何解决如何在不使用dbutil的情况下导入使用Codeigniter导出的SQL转储文件
我使用带有dbigns和codeigniter的sql db导出了数据文件。
$this->load->dbutil();
$this->load->helper('file');
$this->load->helper('download');
$dumpOption = [
'tables' => [],// Array of tables to backup.
'ignore' => [],// List of tables to omit from the backup
'format' => 'txt',// gzip,zip,txt
'filename' => 'mybackup.sql',// File name - NEEDED ONLY WITH ZIP FILES
'add_drop' => true,// Whether to add DROP TABLE statements to backup file
'add_insert' => true,// Whether to add INSERT data to backup file
'newline' => "\n",// Newline character used in backup file
'foreign_key_checks' => false,];
if (ENVIRONMENT !== 'production') {
if ($this->dbutil->database_exists('db')) {
$backup = $this->dbutil->backup($dumpOption);
try {
echo "loading database ..... \n";
write_file('./db/dump/mybackup.sql',$backup,'w+');
echo "preparing media data.... \n";
} catch (Exception $e) {
printf('Message: ' . $e->getMessage());
}
} else {
echo 'database squirrel does not exist.';
}
}
}
但是当我使用phpadmin导入此文件时,却返回了这种问题。
Running: mysql.exe --defaults-file="\appdata\local\temp\tmpp5yat3.cnf" --protocol=tcp --host=127.0.0.1 --user=root --port=3306 --default-character-set=utf8 --comments --database=squirrel < "\\backend\\db\\dump\\mybackup.sql"
ERROR 1050 (42S01) at line 304: Table 'pin_post' already exists
Operation failed with exitcode 1
23:32:49 Import of \backend\db\dump\mybackup.sql has finished with 1 errors
这是发行行。
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `pin_post` AS select `pin`.`pin_id` AS `pin_id`,`pin`.`mem_id` AS `mem_id`,`pin`.`cmnt_id` AS `cmnt_id`,`pin`.`date` AS `date` from `pin`;
utf8_general_ci; <<<< this issue line.
如何解决此问题。 期待听到好消息。 谢谢。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。