Three major installation methods for MySQL 5.5: [binary, source code compilation, and RPM package] installation steps and comparison of advantages and disadvantages

Source: Internet
Author: User
(I) source code compilation


① Install cmake

      # wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz      # tar -zxv -f cmake-2.8.5.tar.gz -C /usr/local/src      # cd /usr/local/src/cmake-2.8.5      # ./bootstrap      # make       # make install

② Create a MySQL user

      # groupadd dba      # useradd -g dba mysql      # cp mysql-5.5.16.tar.gz  /home/mysql/      # chown -R mysql:dba /home/mysql/mysql-5.5.16.tar.gz

③ Cmake: Compile MySQL 5.5.

# Su-mysql $ tar-zxv-F mysql-5.5.16.tar.gz $ CD mysql-5.5.16 $ cflags = "-O3" cxx = GCC $ cxxflags = "-O3-felide-constructors-fno-exceptions-fno -rtti "$ cmake. -lH | more // view MySQL compilation configuration under cmake $ cmake. -dcmake_install_prefix =/home/MySQL-dextra_charsets = all $ make-J 8 // 8-core parallel compilation $ make install

④ Create a configuration file

$ CD/home/MySQL $ su-root # cp/home/MySQL/mysql-5.5.16/support-files/my-medium.cnf/etc/My. CNF/* this step can be omitted. By default, a */# chown-r MYSQL: DBA/etc/My. CNF

⑤ Modify the path of the configuration file, configuration data file, and Log File

# Su-mysql $ CD MySQL $ mkdir run log TMP $ Vim/etc/My. CNF ** added the following content: basedir =/home/MySQL datadir =/home/MySQL/Data socket =/home/MySQL/run/MySQL. the socket configurations of sock/* server and client must be the same */log-error =/home/MySQL/log/alert. log log_slow_queries =/home/MySQL/log/slow. log

Note: version 5.6 and the method for enabling slow query logs are different,

slow_query_log_file = /home/mysql/mysql/log/slow.logslow_query_log = 1

⑥ Initialize the MySQL configuration table

      $ ./scripts/mysql_install_db --basedir=/home/mysql/mysql  --datadir=/home/mysql/mysql/data --user=mysql --force

7. Start MySQL

      ./bin/mysqld_safe &

Benefits: The platform-independent and installed MySQL directory is independent (convenient and clear). It is said that it has better performance and platform coupling.
Disadvantages:Slow compilation and Installation

(Ii) binary distribution edition Installation



The format of the binary distribution version on the official website is: mysql-<version>-<OS> -tar.gz

① Create users and groups

      # groupadd dba      # useradd -g dba mysql

② Decompress the package to the specified directory

      # tar -zxv -f mysql-5.5.30-linux2.6-i686.tar.gz -C /usr/local/      # mv /usr/local/mysql-5.5.30-linux2.6-i686 /usr/local/mysql      # cd /usr/local/mysql

③ Change permissions

      # chown -R mysql .      # chgrp -R dba .

④ Initialize the MySQL configuration table

      # scripts/mysql_install_db --user=mysql

⑤ Change Data Directory Permissions

      # chown -R root .      # chown -R mysql data

6. Copy the configuration file

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

7. Create a soft link

      # ln -s /usr/local/mysql/bin/mysqld_safe /usr/local/bin      # ln -s /usr/local/mysql/bin/mysqladmin /usr/local/bin      # ln -s /usr/local/mysql/bin/mysql /usr/local/bin

⑧ Start MySQL Service

      # bin/mysqld_safe --user=mysql &

Benefits:
MySQL uses glibc for development. The glibc library is an underlying API. Therefore, as long as it is Linux, glibc library will be available, and portability is very convenient.
The system distribution version and source code distribution version. The former has been compiled and optimized, and the latter has not



(Iii) rpm Mode



The RPM package installation method is extremely simple and will not be described here
Talk about other objects

For example, what do MySQL RPM packages mean?

MySQL-VERSION.i386.rpm MySQL server. Unless you just want to connect to the MySQL server running on another machine, you will need it
MySQL-client-VERSION.i386.rpm standard MYSQL client program. You may always need to install this package
MySQL-bench-VERSION.i386.rpm testing and benchmarking procedures. Perl and msql-mysql-modules RPM are required
Library and inclusion files required by the MySQL-devel-VERSION.i386.rpm. If you want to compile other MYSQL client programs, such as the Perl Module
The MySQL-VERSION.src.rpm contains the source code for all of the above packages. It can also be used to try to construct RPM (for example, Alpha or iSCSI) for other hardware platforms)
MySQL-Max-VERSION.rpm contains client and server programs
Database System for MySQL-embedded-VERSION.i386.rpm and embedded Linux

In most cases, you only need to install mysql-server and MySQL-client, and install other packages as needed.

For example, where is the related directory after MySQL rpm is installed?

/Usr/bin: client programs and scripts, such as mysqladmin mysqldump and other commands
/Usr/sbin: mysqld
/Var/lib/MySQL: Database directory
/Usr/share/MySQL: mysql. server command and configuration file
/Etc/rc. d/init. d/: directory for starting the script file MySQL



Last ,,,,,,
Which one is better? I'm afraid no one is better. I can only say which one is more suitable.
Vegetables, radishes, and love each other.

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.