连接到localhost数据库Node.js时出错

编程入门 行业动态 更新时间:2024-10-19 19:43:18
本文介绍了连接到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时出错

本文发布于:2023-10-24 14:27:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1524175.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:连接到   数据库   js   localhost   Node

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!