Node.js connect mysql error -


i have file con_mysql.js 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() done automatically.');         ^ error: deprecated: connect() done automatically.     @ client.connect (/users/chris/node_modules/mysql/lib/client.js:40:9)     @ object.<anonymous> (/users/chris/jswork/nodejs/db/con_mysql.js:5:8)     @ module._compile (module.js:446:26)     @ object..js (module.js:464:10)     @ module.load (module.js:353:31)     @ function._load (module.js:311:12)     @ array.0 (module.js:484:10)     @ eventemitter._tickcallback (node.js:190:38) 

how can resolve problem?

i have installed mysql module this:

# npm install mysql 

deprecated: connect() done automatically.

just try this:

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

the error above states automatically connect. don't need (and cannot) call connect() function.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -