Comparison of Three solutions for installing MySQL in Linux

Source: Internet
Author: User

The following articles mainly show you how to correctly install MySQL in the Linux operating system and compare the installation methods of different MySQL, the three methods include rpm installation, binary installation, and source code installation.

Comparison of installation methods

1. Use rpm for Installation

Easy to install and suitable for beginners

1. You need to download the client and server separately.

2. The installation path is not flexible, and the default path cannot be modified. One server can only install one MySQL

File Layout

/Usr/bin client programs and scripts

/Usr/sbinMySQLd Server

/Var/lib/MySQL Log File, database

/Usr/share/doc/packages document

/Usr/include/MySQL include (header) File

/Usr/lib/MySQL Library

/Usr/share/MySQL error message and Character Set File

/Usr/share/SQL-benchmark program

In most cases, it is enough to download MySQL-server and MySQL-client. The installation method is as follows:

Shell> rpm-ivh MySQL-server-VERSION.i386.rpm

Shell> rpm-ivh MySQL-client-VERSION.i386.rpm

Ii. Binary Installation

1. Easy installation

2. It can be installed in any path with good flexibility.

3. One server can install multiple MySQL instances in MySQL

1) It has been compiled, and the performance is not as good as that of source code compilation.

2) Compilation parameters cannot be customized flexibly.

Bin client program and MySQLd Server

Data Log Files, databases

Docs documentation, ChangeLog

Include (header) File

Lib Library

ScriptsMySQL_install_dbshare/MySQL error message file

SQL-benchmark program

Install

Log on as the root user and perform the following steps:

Code

 
 
  1. shell> groupadd MySQL  
  2. shell> useradd -g MySQL MySQL  
  3. shell> cd /home/MySQL  
  4. shell>tar -xzvf /home/MySQL/MySQL-VERSION-OS.tar.gz  
  5. shell> ln -s MySQL-VERSION-OS.tar.gz MySQL  
  6. shell> cd MySQL  
  7. shell> scripts/MySQL_install_db --user=MySQL 
  8. shell> chown -R root:MySQL .  
  9. shell> chown -R MySQL:MySQL data  
  10. shell> bin/MySQLd_safe --user=MySQL & 

Iii. Source Code Installation

1. You can customize the compilation based on your needs in the actual installed operating system, which is the most flexible.

2. Best Performance

3. One server can install multiple MySQL instances

1. Complicated Installation Process

2. Long Compilation Time

Bin client programs and scripts

Include/MySQL include (header) File

Info Info format document

Lib/MySQL Library

Libexec MySQLd Server

Share/MySQL error message file

SQL-benchmark program and crash-me test

Var database and log files

1) Remove unnecessary modules:

The installation of source code MySQL is more flexible because it can be flexibly customized for database compilation. Some compilation options can greatly enhance the performance of our database.

Run the following command to view all the compilation configuration options:

Shell>./configure -- help

If you only install the client, run the following command:

 
 
  1. shell> ./configure --without-server 

If you do not want the log files and databases in the "/usr/local/var" directory, use one of the following configure commands:

 
 
  1. shell>./configure--prefix=/usr/local/MySQL  
  2. shell>./configure--prefix=/usr/locallocalstatedir=/usr/local/MySQL/data 

The first command changes the installation prefix so that all MySQL content can be installed under "/usr/local/MySQL" instead of the default "/usr/local ". The second command retains the default installation prefix, but overwrites the default directory of the database directory (usually "/usr/local/var") and changes it to/usr/local/MySQL/data. After compiling MySQL, you can use the options file to change the default socket location:

 
 
  1. shell> ./configure\-- with-unix-socket-path=/usr/local/MySQL/tmp/MySQL.sock 

2) select only the character set to use:

Change the default Character Set and sorting rules after installation:

 
 
  1. shell> ./configure -- with-charset=CHARSET 
  2. ./configure --with-collation=COLLATION 

Select the character set to be installed in MySQL:

 
 
  1. shell>./configure --with-extra-charsets=LIST 

List can be any of the following items:

Names of character sets separated by Spaces

Complex-to include all character sets that cannot be dynamically loaded all-to include all character sets in binary

3) Compile with pgcc:

Pgcc 2.90.29 or later:

CFLAGS = "-O3-mpentiumpro-mstack-align-double" CXX = gcc \ CXXFLAGS = "-O3-mpentiumpro-mstack-align-double \-felide-constructors-fno-Restrictions tions -fno-rtti"

4) use static compilation to improve performance:

 
 
  1. shell>./configure --with-client-ldflags=-all-static\  
  2. --with-MySQLd-ldflags=-all-static 

The above content is an introduction to the installation of MySQL in Linux. I hope you will have some gains.

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.