Introduction
This article is an article where the main focus is just to install a MySQL module in NodeJS. In this context, the installation process is in a virtual server running in a VirtualBox application. The virtual server is running with a CentOS 8 operating system in it. Actually, there is already a NodeJS function available in the operating system. In order to install the NodeJS, just look at the article with the title of ‘How to Install NodeJS in Linux CentOS 8 virtual server’ in this link.
Installing MySQL Module in NodeJS running in a virtual server
The following are the steps for achieving the purpose :
1. Access the virtual server directly. If it is possible, just access it remotely. Remote accessing the virtual server is possible using SSH method. For further reference, just read the article with the title ‘How to Remote CentOS Virtual Server running in a VirtualBox with a NAT Network using SSH’ in this link.
2. After successfully logging in to the server, just make sure that the NodeJS is available in the operating system.
3. Next, just execute the following command to install MySQL module :
[root@10 crud]# npm install mysql npm WARN saveError ENOENT: no such file or directory, open '/media/sf_windows/personal/programming/nodejs/crud/package.json' npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN enoent ENOENT: no such file or directory, open '/media/sf_windows/personal/programming/nodejs/crud/package.json' npm WARN crud No description npm WARN crud No repository field. npm WARN crud No README data npm WARN crud No license field. + [email protected] added 11 packages from 15 contributors and audited 11 packages in 42.053s found 0 vulnerabilities [root@10 crud]#
4. Finally, the following is the step for checking whether the MySQL module is available or not after the installation process in the previous step :
[root@10 crud]# npm list /media/sf_windows/personal/programming/nodejs/crud └─┬ [email protected] ├── [email protected] ├─┬ [email protected] │ ├── [email protected] │ ├── [email protected] │ ├── [email protected] │ ├── [email protected] │ ├── [email protected] deduped │ ├─┬ [email protected] │ │ └── [email protected] deduped │ └── [email protected] ├── [email protected] └── [email protected] [root@10 crud]#
As in the above output of the command execution, there is a mysql module appear on the list of the output. It means that the installation is a success.