javascript - Can't connect to MySQL with Sequelize -


i consistently sequelizeconnectionrefusederror when trying connect mysql database on server.

the login credentials correct, port open, seems (and works charm in dev environment).

sorry scarce background information, i'm dumbfounded here - don't know causing problem.

this output mysql --version

mysql  ver 14.14 distrib 5.5.43, debian-linux-gnu (x86_64) using readline 6.3 

and code i'm using initialize sequelize. table want use doesn't exist yet, i'm sure hasn't got problem. i've tried logging in root user well, no dice - still same error.

var sequelize = new sequelize("database", username, password, {     host: "localhost",     dialect: "mysql",     port: 3306,     define: {         paranoid: true     } });  var model = sequelize.define("model", {     md5: {type: sequelize.string(128)},     ip: {type: sequelize.string(256)},     url: {type: sequelize.string(1024)} });  sequelize.sync(); 

this running on ubuntu 14.04, node being run behind passenger (although error appears if run application node directly well). i'm running nginx , php on same server, php application connecting database, if that's of relevance.

what causing problem?

i tried connect database directly mysql module well, gave me same error. when looking solutions same problem, related mysql module rather sequelize, found this: connect econnrefused - node js , sql.

what needed supply mysql module socketpath key. here's how changed code make work:

var sequelize = new sequelize("database", username, password, {     host: "localhost",     dialect: "mysql",     logging: function () {},     pool: {         max: 5,         min: 0,         idle: 10000     },     dialectoptions: {         socketpath: "/var/run/mysqld/mysqld.sock"     },     define: {         paranoid: true     } }); 

Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -