I want to access a MySQL database directly from JavaScript code in an HTML page in Firefox.
Does such a library exist?
To be very clear, CGI+Ajax wil
JavaScript code lives inside the browser. It can make HTTP requests to the outside, but not really much more. So by design you won't be able to bind to a program running locally. If MySQL did expose an HTTP service, it might be possible, but that's not the case.
You might be able to find a plugin for Firefox that exposes a MySQL API to JavaScript, but I don't know any such plugin.
If you don't specifically need MySQL, but just a database accessible from JavaScript code, have a look at Google Gears. It is a Firefox / Internet Explorer plugin that exposes an SQLite database and a few other goodies.
If you give more information on what you are trying to build, we might be able to give you better advice...