Ghost 博客 - 无法连接 mysql
Ghost Blog - Unable to connect with mysql
成功部署 Ghost 博客平台后,我尝试将其配置为使用 Mysql 而不是使用此 database section of their config page 的 sqllite3,它说:
Database
By default, Ghost comes configured to use an SQLite database, which
requires no configuration.
Alternatively Ghost can also be used with a MySQL database by changing
the database configuration. You must create a database and user first,
you can then change the existing sqlite config to something like:
database: { client: 'mysql', connection: {
host : '127.0.0.1',
user : 'your_database_user',
password : 'your_database_password',
database : 'ghost_db',
charset : 'utf8' }
}
好的,设置很简单。但我仍然无法将 ghost 与 mysql 连接起来。使用 npm start --production
启动平台后我收到的错误是:
> ghost@0.6.2 start /var/www/ghost
> node index
Migrations: Database initialisation required for version 003
Migrations: Creating tables...
Migrations: Creating table: posts
ERROR: connect ECONNREFUSED
Error: connect ECONNREFUSED
at errnoException (net.js:905:11)
at Object.afterConnect [as oncomplete] (net.js:896:19)
--------------------
at Protocol._enqueue (/var/www/ghost/node_modules/mysql/lib/protocol/Protocol.js:110:48)
at Protocol.handshake (/var/www/ghost/node_modules/mysql/lib/protocol/Protocol.js:42:41)
at Connection.connect (/var/www/ghost/node_modules/mysql/lib/Connection.js:98:18)
at /var/www/ghost/node_modules/knex/lib/dialects/mysql/index.js:105:16
at tryCatch2 (/var/www/ghost/node_modules/bluebird/js/main/util.js:53:21)
at Promise._resolveFromResolver (/var/www/ghost/node_modules/bluebird/js/main/promise.js:544:13)
at new Promise (/var/www/ghost/node_modules/bluebird/js/main/promise.js:84:37)
at Client_MySQL.acquireRawConnection (/var/www/ghost/node_modules/knex/lib/dialects/mysql/index.js:104:10)
at Object.create (/var/www/ghost/node_modules/knex/lib/pool.js:33:19)
at Object.Pool.createResource (/var/www/ghost/node_modules/knex/node_modules/generic-pool-redux/pool.js:288:12)
我不确定哪里出了问题,因为我有其他使用 mysql 的应用程序可以正常工作。
提前致谢。
connection refused
= 已尝试建立 tcp 连接,但端口上没有任何内容正在侦听,或者被明确拒绝。除非您在 mysql 中明确启用了 TCP 支持(并且具有正确的 ip/port),否则您可能应该改用本地 unix 域套接字。
成功部署 Ghost 博客平台后,我尝试将其配置为使用 Mysql 而不是使用此 database section of their config page 的 sqllite3,它说:
Database
By default, Ghost comes configured to use an SQLite database, which requires no configuration.
Alternatively Ghost can also be used with a MySQL database by changing the database configuration. You must create a database and user first, you can then change the existing sqlite config to something like:
database: { client: 'mysql', connection: { host : '127.0.0.1', user : 'your_database_user', password : 'your_database_password', database : 'ghost_db', charset : 'utf8' } }
好的,设置很简单。但我仍然无法将 ghost 与 mysql 连接起来。使用 npm start --production
启动平台后我收到的错误是:
> ghost@0.6.2 start /var/www/ghost
> node index
Migrations: Database initialisation required for version 003
Migrations: Creating tables...
Migrations: Creating table: posts
ERROR: connect ECONNREFUSED
Error: connect ECONNREFUSED
at errnoException (net.js:905:11)
at Object.afterConnect [as oncomplete] (net.js:896:19)
--------------------
at Protocol._enqueue (/var/www/ghost/node_modules/mysql/lib/protocol/Protocol.js:110:48)
at Protocol.handshake (/var/www/ghost/node_modules/mysql/lib/protocol/Protocol.js:42:41)
at Connection.connect (/var/www/ghost/node_modules/mysql/lib/Connection.js:98:18)
at /var/www/ghost/node_modules/knex/lib/dialects/mysql/index.js:105:16
at tryCatch2 (/var/www/ghost/node_modules/bluebird/js/main/util.js:53:21)
at Promise._resolveFromResolver (/var/www/ghost/node_modules/bluebird/js/main/promise.js:544:13)
at new Promise (/var/www/ghost/node_modules/bluebird/js/main/promise.js:84:37)
at Client_MySQL.acquireRawConnection (/var/www/ghost/node_modules/knex/lib/dialects/mysql/index.js:104:10)
at Object.create (/var/www/ghost/node_modules/knex/lib/pool.js:33:19)
at Object.Pool.createResource (/var/www/ghost/node_modules/knex/node_modules/generic-pool-redux/pool.js:288:12)
我不确定哪里出了问题,因为我有其他使用 mysql 的应用程序可以正常工作。
提前致谢。
connection refused
= 已尝试建立 tcp 连接,但端口上没有任何内容正在侦听,或者被明确拒绝。除非您在 mysql 中明确启用了 TCP 支持(并且具有正确的 ip/port),否则您可能应该改用本地 unix 域套接字。