Three installation methods of MySQL

Source: Internet
Author: User

This article mainly tells you about the three installation methods of MySQL, And the RPM Binary Package and source code. The system platform we installed this time is redhat 5, the following is a detailed description of the main content of the article. I hope you will have a better understanding of it after browsing.

MySQL installation method 1. Use the RPM package for Installation

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 for installation:

Rpm-ivh MySQL-server-community-5.1.38-0.rhel5.i386.rpm

Rpm-ivh MySQL-client-community-5.1.38-0.rhel5.i386.rpm

Three installation methods for MySQL II. Binary Package Installation

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

./Bin/MySQLd_safe -- user = MySQL &

Three installation methods for MySQL 3. 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.

Tar xvfz MySQL-5.1.38.tar.gz

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.

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

./Bin/MySQLd_safe -- user = 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.