还原: Difference between revisions

Jump to navigation Jump to search
Line 59: Line 59:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
mysql mydatabase -h localhost -u databaseuser -pdatabasepass < mybackupfile.sql
</syntaxhighlight>
其中:
* <syntaxhighlight lang="bash">
mysql mydatabase -h localhost -u databaseuser -pdatabasepass < mybackupfile.sql
</syntaxhighlight> 是包含Dolibarr数据的MySQL数据库的名称;
* <syntaxhighlight lang="bash">
mysql mydatabase -h localhost -u databaseuser -pdatabasepass < mybackupfile.sql
</syntaxhighlight>
* <syntaxhighlight lang="bash">
mysql mydatabase -h localhost -u databaseuser -pdatabasepass < mybackupfile.sql
</syntaxhighlight>
* <syntaxhighlight lang="bash">
mysql mydatabase -h localhost -u databaseuser -pdatabasepass < mybackupfile.sql
</syntaxhighlight>
* <syntaxhighlight lang="bash">
mysql mydatabase -h localhost -u databaseuser -pdatabasepass < mybackupfile.sql
</syntaxhighlight>
* <syntaxhighlight lang="bash">
mysql mydatabase -h localhost -u databaseuser -pdatabasepass < mybackupfile.sql
mysql mydatabase -h localhost -u databaseuser -pdatabasepass < mybackupfile.sql
</syntaxhighlight>
</syntaxhighlight>
Line 67: Line 88:


'''备选方案''':您也可以使用 ''phpMyAdmin'' 的导入标签页来还原备份文件(通常,您不必选中任何特定选项,但备份文件必须绝对禁用 foreign_key_checks ,见下文)。然而,与上一方法不同的是,该方法不能保证提供的结果是正确的。
'''备选方案''':您也可以使用 ''phpMyAdmin'' 的导入标签页来还原备份文件(通常,您不必选中任何特定选项,但备份文件必须绝对禁用 foreign_key_checks ,见下文)。然而,与上一方法不同的是,该方法不能保证提供的结果是正确的。
===Troubleshooting===
===故障排除===


[[File:Warning.png]] ERROR 1005 (HY000) at line 20: Can't create table `dolibarr`.`llx_accounting_account` (errno: 150 "Foreign key constraint is incorrectly formed")
[[File:Warning.png]] ERROR 1005 (HY000) at line 20: Can't create table `dolibarr`.`llx_accounting_account` (errno: 150 "Foreign key constraint is incorrectly formed")


=> If you have such error, you mut manually delete the table llx_accounting_account and llx_accounting_system, before trying again.
=> 如果出现此类错误,则必须手动删除表 llx_accounting_account 和 llx_accounting_system,然后再次尝试加载。
 
 
[[File:Warning.png]] Error loading table on foreign key.


=> 必须在'''还原过程中禁用外键检查''',否则由于外键之间的冲突,SQL备份将无法还原!如果备份正确,则应为默认情况。


[[File:Warning.png]] If you have error with foreign keys, check that '''your sql backup file disable foreign keys prior to restoring''', else your backup won't be restorable because of foreign keys clashing!
示例:在SQL文件的开头和结尾添加FOREIGN_KEY_CHECKS:


Eg: Add FOREIGN_KEY_CHECKS in headers and footers:
<syntaxhighlight lang="sql">
<syntaxhighlight lang="sql">
-- SQL Dump
-- SQL Dump
714

edits

Navigation menu