I\'m using this code to connect to local MySQL in Electron (in background.js file) and it\'s working fine. First I installed MySQL2 here\'s the part of package.json