连接到localhost数据库Node.js时出错 [英] Error While connecting to localhost database Node.js

查看:112
本文介绍了连接到localhost数据库Node.js时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是node.js的新手,我定义了一个字符串并希望知道如何使用它,如果我想使用可信连接而没有任何密码或用户名,比如在C#



var configSQL =Server =(local); Database = Loginfm_data; Trusted_Connection = True;;



我使用了上面的连接字符串,但它给了我错误Error Connection ENCOUNTERED

I am new to node.js, I define a string and want to know how to use it, if i want to use trusted connection without any password or username like in C#

var configSQL = "Server=(local);Database=Loginfm_data;Trusted_Connection=True;";

I used the above connection string but it is giving me error "Error Connection ENCOUNTERED"

var connection = mysql.createConnection({
  host     : 'localhost',
  user     : 'FASTIAN-PC',
  password : 'fastian123',
});

connection.connect();





这里是代码和错误

http://img209.imageshack.us/img209/4922/ll0w.jpg [ ^ ]

推荐答案

确保在mysql服务器配置上启用了网络,请参见此处: http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html [ ^ ]





另请阅读: http://stackoverflow.com/questions/5818312/mysql-with-node-js [ ^ ]
Make sure networking is enabled on your mysql server config, see here : http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html[^]


Read this also : http://stackoverflow.com/questions/5818312/mysql-with-node-js[^]


这篇关于连接到localhost数据库Node.js时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆