Home  >  Article  >  Database  >  将 Ghost 从 SQLite3 数据库迁移到 MySQL 数据库_MySQL

将 Ghost 从 SQLite3 数据库迁移到 MySQL 数据库_MySQL

WBOY
WBOYOriginal
2016-05-31 08:46:521176browse

下面我们就来说说如何从 SQLite 迁移到 MySQL 。

准备

首先你要已经安装好 MySQL 数据库。如果你用的是 Ubuntu 系统,请参考这篇文章。其他系统请参考各自对应的文档。

导出当前数据

进入 http://your-domain.com/ghost/debug 页面:

点击蓝色的 EXPORT 按钮将当前数据库中的所有数据导出并下载到本地,默认文件名是 GhostData.json 。

切换数据库配置

编辑 config.js 文件,在 production 配置段将数据库配置修改为 MySQL:

javascript database: { client: 'mysql', connection: { host: 'localhost', //数据库所在服务器 user: '数据库登录名', password: '数据库登录密码', database: '数据库名称', charset: 'utf8' }, debug: false },

上述个字段填写好之后,重新启动 Ghost。

导入数据

由于更换了数据库,新的 MySQL 数据库中没有任何内容,也没有任何登陆账号,这时需要我们新建一个临时账号,然后再次登陆进 http://your-domain.com/ghost/debug 页面(如上图)将之前导出的数据重新导入。

再次重新打开你的网站页面,是否原来的数据都回来了!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn