15

I'm using MySQL for a Rails application and would like to be able to use this database for a Node.js app (in particular Tower.js). What is the most mature and/or performant driver available for this at the moment?


Due to @ryan's excellent input below, I looked a bit more into Felix's node-mysql There is an absolutely EXCELLENT podcast here that's I'd highly recommend listening to if you're interested in a slight history and general discussion as to the options and if node-mysql path may be right for you: http://ia600804.us.archive.org/3/items/NodeupEleven/NodeupEleven.mp3

After giving that roundtable discussion a quick listen up to that point, I'm pretty confident that this is the right path for about anyone to take right now. Further, the other discussions that go around are interesting as a general state of database support in Node.

ylluminate
  • 12,102
  • 17
  • 78
  • 152

1 Answers1

12

Here is a link to all the MySQL modules on the Node.js GitHub Wiki.

node-mysql seems to be what you're looking for. It has by far the most watchers and development looks very active.

However, there is quite a selection on the Wiki page, you might want to have a look there first to see if there is something that better suits your needs.

Ryan
  • 3,726
  • 3
  • 26
  • 38
  • 2
    node-mysql sucks. No support for prepared statements. It "fakes" them by escaping and executing completely separate queries. – doug65536 Dec 13 '13 at 11:00
  • so? any other that is better than node-mysql ? been curious to know since I need to use mysql db too – v0d1ch Nov 17 '14 at 12:13
  • @doug65536 Quite some time has passed since your comment. Do you by any chance know if this issue still applies, or whether it is tracked in a GitHub issue somewhere? EDIT: Could be [this issue](https://github.com/mysqljs/mysql/issues/274). – bluenote10 Feb 01 '21 at 11:49
  • @bluenote10 That issue looks correct. Seems like [a fork](https://github.com/sidorares/node-mysql2) was made that implements it. – doug65536 Mar 06 '21 at 21:40