1
我能够从mysql CLI访问我的aws rds mysql实例。但是相同的配置不适用于sailsjs数据库适配器。无法使用Sailsjs适配器连接aws rds
这是我./config/env/production.js
connections: {
mysqlServer: {
host: "demo.c4a1v1iyi4x1.ap-southeast-1.rds.amazonaws.com",
user: "username",
password: "password",
database: "mydb",
},
},
我已经修改了我的./config/models.js创建表
/**
* Default model configuration
* (sails.config.models)
*
* Unless you override them, the following properties will be included
* in each of your models.
*
* For more info on Sails models, see:
* http://sailsjs.org/#/documentation/concepts/ORM
*/
module.exports.models = {
/***************************************************************************
* *
* Your app's default connection. i.e. the name of one of your app's *
* connections (see `config/connections.js`) *
* *
***************************************************************************/
connection: 'mysqlServer',
/***************************************************************************
* *
* How and whether Sails will attempt to automatically rebuild the *
* tables/collections/etc. in your schema. *
* *
* See http://sailsjs.org/#/documentation/concepts/ORM/model-settings.html *
* *
* In a production environment (NODE_ENV==="production") Sails always uses *
* migrate:"safe" to protect inadvertent deletion of your data. *
* However development has a few other options for convenience: *
* *
* safe - never auto-migrate my database(s). I will do it myself (by hand) *
* alter - auto-migrate, but attempt to keep existing data (experimental) *
* drop - wipe/drop ALL my data and rebuild models every time I lift Sails *
* *
***************************************************************************/
migrate: 'alter',
};
使用上述配置,帆。 js无法在aws rds实例中连接或创建表。任何人都可以帮助我解决这个问题。提前致谢。
向我们显示错误消息。 –
嘿zabware,它不会给出任何错误消息。感谢回复。 –
得到了错误。生产环境中的Sails.Js强制水线使用“迁移:安全”而不是“改变”或“下降”。所以,任何表创建都被禁止了。因此,我使用'migrate:alter'替代了开发配置并创建了表。 –