Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access a MySQL Database in Electron

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: I am very new to Electron

Thank you for your help.

like image 603
Xibition Avatar asked Jul 15 '16 08:07

Xibition


1 Answers

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.

like image 110
Shawn Rakowski Avatar answered Oct 17 '22 05:10

Shawn Rakowski