Three common ways to install Mysql _mysql

Source: Internet
Author: User
Tags install php mysql version

Directory

There are three common ways to install MySQL:

RPM Package Form

Universal binary Form

Source code Compilation

1,rpm Package Form

(1) The operating system publisher provides

(2) MySQL officially provided (version update, fixed more common bugs) www.mysql.com/downloads

Introduction to the type of RPM package in MySQL:

Mysql-client Client Components
Mysql-debuginfo Debug the MySQL component
Mysql-devel would like to install PHP for MySQL compiler and so on MySQL-dependent component packages
mysql-embedded MySQL's embedded version
Mysql-server Shared Library
Mysql-shared Shared Library
Mysql-shared-dompat for compatibility with older versions of shared libraries
Mysql-test MySQL test kit (on-line processing function)

Installation method:

You can first download the corresponding version of the RPM package from the installation CD or to the MySQL Web site as follows:

mysql-server-community-5.5.28-1.rhel5.i386.rpm
mysql-client-community-5.5.28-1.rhel5.i386.rpm

We can then install using the RPM command:

RPM-IVH mysql-server-community-5.5.28-1.rhel5.i386.rpm
RPM-IVH mysql-client-community-5.5.28-1.rhel5.i386.rpm

Add one point:

-H display installation progress with symbol #
-V reporting on each step of the operation

2, Universal binary Package

(1) New user to run the process in a safe manner:

 Groupadd-r MySQL 
 useradd-g mysql-r-s/sbin/nologin-m-d/mydata/data MySQL 
 

(2) Installation and initialization of mysql-5.5.28

First download the corresponding MySQL version of the platform to the local, here is the 32-bit platform, therefore, selected for the mysql-5.5.28-linux2.6-i686.tar.gz

Tar XF mysql-5.5.28-linux2.6-i686.tar.gz-c/usr/local 
 cd/usr/local/ 
 ln-sv mysql-5.5.28-linux2.6-i686 mysql< C8/>CD MySQL 
 chown-r mysql:mysql. 
 scripts/mysql_install_db--user=mysql--datadir=/mydata/data 
 chown-r root. 

(3) Provide the main configuration file for MySQL:

 Cd/usr/local/mysql 
 

(4) Modify the configuration file:

Modify the value of thread_concurrency in this file to multiply your CPU number by 2, for example, use the following line:

Thread_concurrency = 2

You also need to add the following line to specify where the MySQL data file will be stored:

DataDir =/mydata/data

(5) Provide SYSV service script for MySQL:

Cd/usr/local/mysql 
 

(6) Add to the list of services:

 Chkconfig--add mysqld 
 

(7) Then you can start the service test use.

Service mysqld Start

3, source code compilation

(Installation of a change in the way, the configuration process is not too much change, so the following details are not detailed)
To compile the source code on the 5.0 series Red Hat system MySQL must be built on a cross-platform compiler cmake

So:

(1) First install CMake

Install cmake need to use make

 The tar XF cmake-... tar.gz 
 cd cmake-.. 
 . /bootstrap  uses this script to detect the compilation environment make 
  
 

(2) Compile and install mysql-5.5.28

Using CMake to compile mysql-5.5.28, the options are changed in a simple way ...

CMAKE specifies compilation options in a different way than make, which is implemented in the following ways:

CMake.

CMake.        -lh or Ccmake. Find related options that you can use

The options that are commonly used when specifying the installation path for installation files:

-dcmake_install_prefix=/usr/local/mysql Specify Installation path
-dmysql_datadir=/data/mysql Data Installation path
-DSYSCONFDIR=/ETC Configuration File Installation path

Because MySQL supports a large number of storage engines, the default compiled storage engine includes CSV, MyISAM, MYISAMMRG, and heap. To install additional storage engines, you can use a compilation option similar to the following:

-dwith_innobase_storage_engine=1 Install Innobase Storage Engine
-dwith_archive_storage_engine=1 Install ARCHIVE Storage Engine
-dwith_blackhole_storage_engine=1 Install blackhole Storage Engine
-dwith_federated_storage_engine=1 Install federated Storage Engine

To explicitly specify that a storage engine is not compiled, you can use an option similar to the following:

-dwithout_<engine>_storage_engine=1

Like what:

-dwithout_example_storage_engine=1 does not enable or compile the EXAMPLE storage engine
-dwithout_federated_storage_engine=1
-dwithout_partition_storage_engine=1

If you want to compile into other functions, such as SSL, you can use one of the following options to implement a library or not use a library when compiling:

-dwith_readline=1
-dwith_ssl=system represents the use of a self-contained SSL library on the system
-dwith_zlib=system
-dwith_libwrap=0

Other common options:

-dmysql_tcp_port=3306 Set the default port
-dmysql_unix_addr=/tmp/mysql.sock the location of sockets for MySQL interprocess communication
-denabled_local_infile=1 whether to start the local local_infile
What additional character sets are supported by-dextra_charsets=all
-ddefault_charset=utf8 Default Character Set
-ddefault_collation=utf8_general_ci default character Set sorting rules
-dwith_debug=0 whether to start the DEBUG feature
-denable_profiling=1 whether the profiling feature is enabled

If you want to clean up the files generated by the previous compilation, you need to use the following command:

Make clean
RM CMakeCache.txt

Compiling the installation

Tar XF mysql-5.5.28.tar.gz 
 cd mysql-5.5.28 
 groupadd-r mysql 
 useradd-g-r mysql MySQL 
 mkdir-pv/data/my Data 
 chown-r mysql:mysql/data/mydata 
 cmake.-dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/data /mydata-dsysconfdir=/etc-dwith_innobase_storage_engine=1-dwith_archive_storage_engine=1-dwith_blackhole_ storage_engine=1-dwith_readline=1-dwith_ssl=system-dwith_zlib=system-dwith_libwrap=0-dmysql_unix_addr=/tmp/ Mysql.sock-ddefault_charset=utf8-ddefault_collation=utf8_general_ci make make 
 install
 cd/usr/local/ MySQL 
 chown-r: mysql. Change group 
 scripts/mysql_install_db--user=mysql--datadir=/data/mydata/Specify data storage location
 CP Support-files/my-large.cnf/etc/my.cnf  

Edit configuration file

Vim/etc/my.cnf

Add the following line to specify where the MySQL data file will be stored:

DataDir =/mydata/data

Creating execution scripts and starting services

CP support-files/mysql.server/etc/rc.d/init.d/mysqld Replication Script 
 chmod +x/etc/rc.d/init.d/mysqld Execute permissions 
 chkconfig- Add MySQL added to the list of services service 
 mysqld start  service 
 bin/mysql    start MySQL 

The above is this article to introduce you to install MySQL common three kinds of ways, I hope you like.

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.