Three types of MySQL installation methods

Source: Internet
Author: User

We all know that there are three ways to install MySQL: RPM Binary Package and actual application source code. The system platform we have installed this time is redhat 5. The following describes the specific solution, I hope this will help you in your future studies.

1. Install MySQL using the RPM package

First, you can download the rpm package of the corresponding version from the installation disc or to the MySQL website as follows:

 
 
  1. MySQL-server-community-5.1.38-0.rhel5.i386.rpm   
  2. MySQL-client-community-5.1.38-0.rhel5.i386.rpm  

Then we can use the rpm command to install MySQL:

 
 
  1. rpm -ivh MySQL-server-community-5.1.38-0.rhel5.i386.rpm   
  2. rpm -ivh MySQL-client-community-5.1.38-0.rhel5.i386.rpm  

Ii. Install Binary packages

The procedure is as follows:

1. Use root to log on to the system and add MySQL users and groups.

 
 
  1. groupadd MySQL   
  2. useradd -g MySQL MySQL  

2. decompress the Binary Package. If the Binary Package is stored in/home/MySQL, decompress the package and add a symbolic link.

 
 
  1. tar xvfz MySQL-5.1.38-linux-i686-glibc23.tar.gz   
  2. ln -s MySQL-5.1.38-linux-i686-glibc23 MySQL  

3. Create a system database table in the database directory. -- user indicates that the owner of these databases and tables is the user

 
 
  1. cd MySQL   
  2. ./scripts/MySQL_install_db --user=MySQL  

4. Set directory permissions and change the owner of the data directory to MySQL. The owner of files in other directories is root.

 
 
  1. chown -R root:MySQL .   
  2. chown -R MySQL:MySQL data  

5. Start MySQL

 
 
  1. ./bin/MySQLd_safe --user=MySQL &  

Iii. Install MySQL with source code

1. Use root to log on to the system and add MySQL users and groups.

 
 
  1. groupadd MySQL   
  2. useradd -g MySQL MySQL  

2. decompress the source code package and enter the decompressed directory.

 
 
  1. tar xvfz MySQL-5.1.38.tar.gz   
  2. cd MySQL-5.1.38  

3. Use the configure tool to compile the source code. here we can use a lot of parameters. For details, see configure -- help. Here we will install MySQL under/usr/local/MySQL.

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

4. select a sample configuration file and copy it to/etc/and rename it my. cnf.

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

5. Create a system database table in the database directory. -- user indicates that the owner of these databases and tables is the user

 
 
  1. cd /usr/local/MySQL   
  2. ./bin/MySQL_install_db --user=MySQL  

6. Set directory permissions and change the owner of the var directory to MySQL. The owner of other directories and files is root.

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

7. Start MySQL

 
 
  1. ./bin/MySQLd_safe --user=MySQL &  

The above content is an introduction to the three MySQL installation methods. I hope you will have some gains.

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.