Not working with latest version of node-mysql #45

davidleureka opened this Issue Nov 5, 2012 · 1 comment


None yet
3 participants

Is it safe to say that persist will not work with the latest version of node-mysql?

I am running the following code:

var persist = require("persist");

var opts = {
driver: 'mysql',
host: 'localhost',
database: 'test2',
user: 'root',
password: 'xxxxxx'

persist.connect(opts, function (err, connection) {

and getting the following error:

var db = new mysql.createClient(opts);
TypeError: undefined is not a function
at Class.Driver.extend.connect (node_modules/persist/lib/drivers/mysql.js:97:16)
at Object.exports.connect (node_modules/persist/lib/persist.js:86:10)
at Object. (test.js:9:9)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)

Turns out that node-mysql has not had a createClient method in a while. This is from the readme:

v2.0.0-alpha (2012-05-15)

This release is a rewrite. You should carefully test your application after
upgrading to avoid problems.
The first thing you will run into is that the old Client class is gone and
has been replaced with a less ambitious Connection class. So instead of
mysql.createClient(), you now have to:

var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'me',
password : 'secret',

joeferner closed this Nov 27, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment