Node.js connect mysql error

I have a file con_mysql.js with the following content:

var client = require('mysql');
client.createClient({'host':'localhost','port':3306,'user':'root','password':'root'});
client.connect();

then:

# node con_mysql.js

chris:db chris$ node my.js 

/Users/chris/node_modules/mysql/lib/client.js:40
  throw new Error('deprecated: connect() is now done automatically.');
        ^
Error: deprecated: connect() is now done automatically.
    at Client.connect (/Users/chris/node_modules/mysql/lib/client.js:40:9)
    at Object.<anonymous> (/Users/chris/jswork/nodejs/db/con_mysql.js:5:8)
    at Module._compile (module.js:446:26)
    at Object..js (module.js:464:10)
    at Module.load (module.js:353:31)
    at Function._load (module.js:311:12)
    at Array.0 (module.js:484:10)
    at EventEmitter._tickCallback (node.js:190:38)

how can I resolve this problem?

I have installed mysql module like this:

# npm install mysql

deprecated: connect() is now done automatically.

Just try this:

client.createClient({'host':'localhost','port':3306,'user':'root','password':'root'});

The Error above states that it will automatically connect. You don't need to (and obviously cannot) call the connect() function.