简体   繁体   English

在cPanel上使用不同名称还原MySQL数据库

[英]Restoring MySQL database with different name on cPanel

I created a database backup on cPanel, before things went a bit wrong. 在出现问题之前,我在cPanel上创建了数据库备份。

We managed to screw up a live WordPress site, and would like to restore the the DB as a different name for the development site before launching it back to the live site. 我们设法修复了一个活动的WordPress网站,并希望在将该数据库重新启动回该活动网站之前,将该数据库恢复为开发网站的其他名称。

Is there a way to restore a cPanel MySQL backup to a different database name? 有没有办法将cPanel MySQL备份还原到其他数据库名称?

Thanks. 谢谢。

Since you're saying "cPanel" so assuming that it's from cPanel's built-in backup utility so in .sql.gz format. 由于您说的是“ cPanel”,因此假设它来自cPanel的内置备份实用程序,因此格式为.sql.gz。 You'll just need to gunzip (extract) that file, you'll find a .sql file inside of that. 您只需将文件压缩(解压缩),即可在其中找到一个.sql文件。 Simply create a new database, go into PHPMyAdmin, click on Import, select that .sql file (which you got after extraction), import it & you're done. 只需创建一个新数据库,进入PHPMyAdmin,单击“导入”,选择该.sql文件(提取后得到的文件),将其导入即可。

EDIT: Just to be on safe side, you can make sure that .sql file doesn't have something like "CREATE DATABASE". 编辑:为了安全起见,您可以确保.sql文件没有类似“ CREATE DATABASE”的内容。 It shouldn't be there as per cPanel's standards but just be safe. 它不应该按照cPanel的标准存在,而是安全的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM