简体   繁体   English

如何配置node-mysql?

[英]How to configure node-mysql?

I've found a lot of tutorials explaining how to install "node-mysql" (basically: "npm install mysql" and that's it) and others explaining how to make queries but nothing in-between. 我发现了很多教程,解释了如何安装“node-mysql”(基本上是:“npm install mysql”,就是这样)以及其他解释如何进行查询的内容。

I mean: with no GUI, how do you configure node-mysql (Mysql login, Mysql password, first table,..) before using it? 我的意思是:没有GUI,在使用之前如何配置node-mysql(Mysql登录,Mysql密码,第一个表,..)?

OR: How to install a GUI to access node-mysql for edition (which would solve problem 1)? 或者:如何安装GUI来访问node-mysql版本(这将解决问题1)?

I tried "Mysql Workbench" via its wizard but I get a "Cannot connect to Database Server" while the host and the port are ok. 我通过它的向导尝试了“Mysql Workbench”,但是当主机和端口没问题时,我得到了“无法连接到数据库服务器”。 I searched the "MySQL Workbench" website but there's nothing about node-mysql. 我搜索了“MySQL Workbench”网站,但没有关于node-mysql的信息。

Node-Mysql seems to be the first choice when it comes to use mysql with node.js but, surprisingly, there's absolutely nothing about my issues, anywhere. 在使用带有node.js的mysql时,Node-Mysql似乎是首选,但令人惊讶的是,在任何地方都没有关于我的问题。

Thank you for your help. 谢谢您的帮助。

you don't need to configure node-mysql itself, you need to learn how to add users to mysql database . 你不需要配置node-mysql本身,你需要学习如何将用户添加到mysql数据库

if you already have existing user, node-mysql client is very straightforward to use: 如果您已有现有用户,则node-mysql客户端使用起来非常简单:

var client = mysql.createClient({
  user: 'someusername',
  password: 'somepassword',
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM