本文介绍了连接到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();这里是代码和错误 img209.imageshack.us/img209/4922/ll0w.jpg [ ^ ]
推荐答案确保在mysql服务器配置上启用了网络,请参见此处: www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html [ ^ ] 另请阅读: stackoverflow/questions/5818312/mysql-with-node-js [ ^ ] Make sure networking is enabled on your mysql server config, see here : www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html[^] Read this also : stackoverflow/questions/5818312/mysql-with-node-js[^]
更多推荐
连接到localhost数据库Node.js时出错
发布评论