There is a way. There is always a way. You can use node.js to connect to a mysql database: http://dseifried.wordpress.com/2011/09/30/node-js-connecting-to-a-database-and-some-very-basic-authentication/
Js is client side...use server side scripts like asp or php
There is no way you can use js to get connected to mysql db. Use php for this purpose.
I think you just can't. It's done in PHP commands.