在Electron中访问MySQL数据库 [英] Access a MySQL Database in Electron

查看:4889
本文介绍了在Electron中访问MySQL数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Electron创建一个应用程序,并希望在我的本地主机中选择并插入/更新一个MySQL数据库中的某些表,如何与数据库建立连接?

I am using Electron to create an app, and wanted to get to select and insert/update some table in a MySQL Database in my localhost, how can I make the connection with the Database ?

PS:我是Electron的新手。

PS: I am very new to Electron

感谢您的帮助。

推荐答案

Electron是Chromium(Chrome中使用的网络渲染器)和Node.js的组合。将Node.js添加到组合中使得Electron能够以普通网页不能以本地操作系统的方式工作。通过Node.js,您可以访问Node当前可用的所有库,因此此问题的答案与如何从Node.js连接到MySQL的答案相同,您可以在这里找到: 具有Node.js的MySQL 。这个答案中的代码应该在Electron中工作。

Electron is the combination of Chromium, the web renderer used in Chrome, and Node.js. Adding Node.js to the mix gives Electron the ability to work with the native OS in ways normal web pages cannot. With Node.js at your disposal you have access to all the libraries that are currently available to Node, and so the answer to this question is the same as the answer to how to connect to MySQL from Node.js which you can find here: MySQL with Node.js. The code in this answer should work in Electron.

这篇关于在Electron中访问MySQL数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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