How to use MySQL to learn how to install MongoDB

Source: Internet
Author: User
Tags install mongodb mongodb server

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:

 
 
  1. [mysqld]  
  2. basedir=D:\MySQL  
  3. 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:

 
 
  1. 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

 
 
  1. rpm –ivh MySQL-server-community-5.1.45-1.rhel5.i386.rpm  
  2. 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

 
 
  1. groupadd mysql  
  2. useradd –g mysql mysql 

Step 2:Decompress the downloaded mysql package

 
 
  1. 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

 
 
  1. cd /usr/local/mysql  
  2. 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

 
 
  1. groupadd mysql  
  2. useradd –g mysql mysql 

Step 2:Decompress the downloaded mysql package

 
 
  1. tar zxvf mysql-5.1.45.tar.gz  
  2. 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.

 
 
  1. ./configuer --prefix=/usr/local/MySQL  
  2. make  
  3. make install 

Step 4:Select a configuration file and copy it to/etc/and rename it my. cnf

 
 
  1. cp support-files/my-medium.cnf /etc/my.cnf 

Step 5:Initialize and install the mysql database

 
 
  1. cd /usr/local/mysql  
  2. bin/mysql_install_db --user=mysql 

Step 6:Modify Directory Permissions

 
 
  1. chown -R root .  
  2. chown -R MySQL var  
  3. chgrp -R MySQL . 

Step 7:Enable MySQL Service

 
 
  1. ./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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.