With the development of the Internet and the emergence of new technologies, traditional management of a group of similar databases has rarely appeared. Managing different types of databases is a new way for most database administrators. In the actual application of enterprises, there are various solutions and products to store data, such as forms of data such as tables, images, and videos that we often encounter, these solutions and products include Oracle, Microsoft SQL Server, DB2, Informix, Sybase, or open source databases such as MySQL and PostgreSQL. Most enterprises require DBAs to have the skills to manage multiple heterogeneous databases. All talents with rich knowledge of various data sources are indispensable to enterprises.
MongoDB is a distributed file storage-based database written in C ++. It is designed to provide scalable and high-performance data storage solutions for WEB applications.
This article will help you learn about MongoDB based on the existing MySQL knowledge, and will guide you quickly to understand MongoDB.
Install
First, let's take a look at the installation steps of MySQL and MongoDB. The installation steps are very simple.
1. Install MySQL on Windows
You can download the MySQL Server installation package from the following website: http://dev.mysql.com/downloads/. the installation method is equivalent to the download Installer. The two installation methods are used:
(1) MSI Installer Installation
Download the msi installer on the official website, double-click the mysql-5. *. *-win32.msi, after the installation interface appears step by step follow the prompts to install:
This installation method is easy to understand and conforms to the new software installation habits. Next, let's take a look at the installation method without installation.
(2) ZIP Installation
If you are an advanced user, I would like to use this method for installation, because you can customize more options to facilitate management and maintenance.
Step 1:Download the zip installer on the official website,
Step 2:Decompress the file to the selected directory, such as "D: \ MySQL \"
Step 3:In the "D: \ MySQL \" directory, create a file named my. ini and add the following data to it:
- [mysqld]
- basedir=D:\MySQL
- datadir=D:\MySQL\data
This method is more flexible for a professional DBA.
2. Install MongoDB on Windows
MongoDB is only installed in zip mode on the Windows platform, and the installation and configuration are much simpler than MySQL, as shown below:
Step 1:Download the ZIP installation package from the official website. Check whether the package is 64-bit or 32-bit. Select the correct version.
Step 2:Decompress the downloaded installation package on the "D:" disk and rename it to "mongodb"
Step 3:Create the "d: \ data \ db" directory to store data files
Step 4:Run the "d: \ mongodb \ bin \ mongod.exe" file to start the MongoDB server.
Step 5:Open the browser and enter the URL "http: // localhost: 27017/". If the following page appears, the system is started properly:
- You are trying to access MongoDB on the native driver port. For http diagnostic access, add 1000 to the port number
3. Install MySQL in Linux
There are three common installation methods for MySQL in Linux.
(1) RPM Installation
Step 1:Download the mysql server and client rpm installation files from the official website
Step 2:Run rpm Installation
- rpm –ivh MySQL-server-community-5.1.45-1.rhel5.i386.rpm
- rpm –ivh MySQL-client-community-5.1.45-1.rhel5.i386.rpm
This completes the mysql rpm installation.
(2) binary Installation
Step 1:Create a MySQL user and user group
- groupadd mysql
- useradd –g mysql mysql
Step 2:Decompress the downloaded mysql package
- tar zxvf mysql-5.1.45.tar.gz
Step 3:Move mysql-5.1.45 to/usr/local/mysql
Step 4:Initialize and install the mysql database
- cd /usr/local/mysql
- scripts/mysql_install_db --user=mysql
This completes the binary installation of mysql.
(3) source code Installation
Source code installation provides a way for advanced users to customize the installation. Users can configure more options and use MySQL more flexibly.
Step 1:Create a MySQL user and user group
- groupadd mysql
- useradd –g mysql mysql
Step 2:Decompress the downloaded mysql package
- tar zxvf mysql-5.1.45.tar.gz
- cd mysql-5.1.45
Step 3:Use the configure tool to compile the source code. here we can use a lot of parameters. For details, use configure -- help. Here we install MySQL under/usr/local/MySQL.
- ./configuer --prefix=/usr/local/MySQL
- make
- make install
Step 4:Select a configuration file and copy it to/etc/and rename it my. cnf
- cp support-files/my-medium.cnf /etc/my.cnf
Step 5:Initialize and install the mysql database
- cd /usr/local/mysql
- bin/mysql_install_db --user=mysql
Step 6:Modify Directory Permissions
- chown -R root .
- chown -R MySQL var
- chgrp -R MySQL .
Step 7:Enable MySQL Service
- ./bin/mysqld_safe --user=mysql
In this way, the source code of mysql is installed.
4. Install MongoDB in Linux
The installation steps for MongoDB Linux are the same as those for Windows, but the operating system is different.
Step 1:Download the tgz installation package from the official website. Check whether the installation package is 64-bit or 32-bit. Select the correct version.
Step 2:Decompress the downloaded installation package on the "/Apps/" disk and rename it to "mongodb"
Step 3:Create a "/data/db" directory to store data files
Step 4:Run the "/Apps/mongodb/bin/mongod" file to start the MongoDB server.
Step 5:Open the browser and enter the URL "http: // 192.168.1.103: 28017/". If you enter the user name and password, the system is started properly.
To sum up, for MongoDB, a new warrior in the NoSQL field, its installation method is simpler and more convenient than MySQL.