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

查看:114
本文介绍了在 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 是 Chrome 中使用的 Web 渲染器 Chromium 和 Node.js 的组合.将 Node.js 添加到混合中使 Electron 能够以普通网页无法使用的方式与本机操作系统一起工作.使用 Node.js,您可以访问 Node 当前可用的所有库,因此这个问题的答案与如何从 Node.js 连接到 MySQL 的答案相同,您可以在此处找到:MySQL 与 Node.js.此答案中的代码应该可以在 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天全站免登陆