Connect to node.js after installing MySQL - mysql

When I type var mysql=require('mysql');, I get an error that mysql module is not found.
In which folder of node.js should MySQL be placed? Should the entire MySQL folder be placed?

I'm not quite sure what mysql folder you are talking about but I would recommend just using npm for this and letting it handle the installation of the package.
Simply go into the folder of your project and install the MySQL Module using npm install mysql.
You can read more about using and installing the MySQL Module here.

Related

Object reference not set to an instance of an object on mySQL Installer while configuring mySQL Server 8.0.25

I recently deleted mySQL and now when i am trying to reinstall it is giving me an error while configuring the mySQL Server
i have tried deleting everything from program file and registry also still no success
enter image description here
I found the issue.
When you install with the Installer 1.4, it won't work.
You should be good if you use V.1.6 of the installer.
https://dev.mysql.com/downloads/installer/

sql.h not found in Linux

I'm trying to migrate a PostgreSQL db to MySQL using Workbench and I need the PostgreSQL drivers to make the connection.
I'm following this post for installing the drivers and I'm having some issues while runing the make command:
./psqlodbc.h:41:10: fatal error: 'sql.h' file not found
I've read here that I need to install unixodbc-dev but then I have to uninstall libiodbc2-dev which then make reports missing iodbcinst.h file!
Is there a package where both headers are present? How can I install sql.h manually in the system?
BTW: I'm using Linux Mint.

Can't build the MySQL drivers (Qt)

I'm trying to build the MySQL drivers for Qt. I've downloaded and installed the MySQL Server files and I also got the Qt source files. After that i've tried to build the MySQL plugin, by opening the MySQL pro file (located at Qtbase/src/plugins/sqldrivers/mysql) and I've add path to the MySQL Server files (include and lib). When I now try to build it, I get the error "cannot open file 'mysql.lib'". So I checked if there is a mysql.lib file in the MySQL Server lib path and there wasnt, so I downloaded the C++ MySQL connector, but it doesnt contain a mysql.lib file either. So I need help, I'm not sure if I'm doing it right and if so, where can I get the mysql.lib file?
Thanks for all the help
Greets
Steven

Requirements for mysql database in node.js server [duplicate]

This question already has answers here:
MySQL with Node.js
(9 answers)
Closed 8 years ago.
I've installed node.js on my pc and created a server. Now, I'm trying use mysql module but it never connects with the database. I think I did not installed enough requirements for it.
I just installed the mysql module with the command:
npm install mysql
Please tell me what should I install now? Do I need mysql cluster installed? Or anything else?
To install the MySQL node.js driver:
If you run just npm install mysql, you need to be in the same directory that your run your server. I would advise to do it as in one of the following examples:
For global installation:
npm install -g mysql
For local installation:
1- Add it to your package.json in the dependencies:
"dependencies": {
"mysql": "~2.3.2",
...
2- run npm install
Note that for connections to happen you will also need to be running the mysql server (which is node independent)
To install MySQL server:
There are a bunch of tutorials out there that explain this, and it is a bit dependent on operative system. Just go to google and search for how to install mysql server [Ubuntu|MacOSX|Windows]. But in a sentence: you have to go to http://www.mysql.com/downloads/ and install it.

Connecting mysql and tomcat?

Hi I am new to tomcat and mysql.
I have installed Tomcat and mysql in Ubuntu 9.10 and both are working great!!
But now I have task of connecting mysql and tomcat.
I dont have any idea on this. However I looked some manuals but did not find any luck.
Guy, Please give me the step by step procedure on how to connect mysql with tomcat.
btw I have downloaded mysql connector and copied the .jar file to $CATALINA_HOME/lib
What else should I do ?
Thanks!
#at0mzk
This is the steps I followed to install tomcat http://www.linuxnix.com/2010/12/how-to-install-apache-tomcat-on-linuxredhatubuntu.html and I installed mysql server and client using the commands sudo apt-get install mysql-server mysql-client later I downloaded JDBC Driver for MySQL (Connector/J) from http://www.mysql.com/products/connector/ and extrated it and pasted the .jar file in /opt/apache-tomcat-6.0.29/lib ( I dont have $CATALINA_HOME/common/lib) . My questions are 1) Is the connection between tomcat and sql established ? 2) do i need to install mysql-server when I have tomcat server ?
Which manual did you follow when installing? Should follow installation intructions in the Tomcat manual for your version. For example 5.5:
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html#MySQL_DBCP_Example
note that manual says $CATALINA_HOME/common/lib, not $CATALINA_HOME/lib
"do i need to install mysql-server when I have tomcat server"
Firstly, do you need mysql at all? I have plenty of web apps that use alternative databases, even embedded ones. Mysql is not required to run Tomcat.
"Is the connection between tomcat and sql established"
Secondly, individual web applications can themselves establish a connection to mysql directly.
I don't know much about the process of setting up a Tomcat JNDI data source as at0mzk has pointed out, as I've never done it, but I suspect it is again up to the individual application to seek out that service and connect to the database using it. I can say that you don't necessarily need it though, depending on what your applications' require.