Open Source Service topics--------MySQL compilation and installation

Source: Internet
Author: User
Tags chmod mysql version

Why Choose MySQL

1:mysql Excellent performance, stable service, and very few abnormal outages

2:mysql Open Source free, no copyright restrictions, autonomy and low cost of use

3: Product coupling, MySQL supports multiple operating systems, supports multiple development languages, especially PHP

4: The accumulation of technology, the huge active community,

5: Small size, easy to install, easy to maintain

MySQL database classification and version upgrade

The MySQL website Http://www.mysql.com/,MySQL version uses the dual authorization policy, like most open source product route, divides into the Community edition and the commercial edition, and these two versions are divided into four versions to publish sequentially, the alpha, the beta, the RC version and the GA edition

GA version is the official version

1: The difference between Community Edition and Enterprise Edition

1) First price, Community edition is completely free, Enterprise Edition requires high cost

2) Technically, the Enterprise Edition has MySQL Enterprise-Class Server, MySQL enterprise-class system monitoring tool. Enterprise Edition after rigorous testing certification, relative to the enterprise version, the community version of the development test environment is not so strict

3) service, the community version of MySQL official does not provide any technical support, the use of the process of any accident is not responsible for the enterprise version of the contrary

4) The commercial version does not support GPL protocol

2:mysql product Line

Three product lines

1) 5.0.XX to 5.1.XX product line

This product line continues to improve the user experience and performance, while adding new features, is the continuation of MySQL early products, such as Rhel6 's own MySQL

2) 5.4.XX start to 5.7.XX product series

The MySQL community and third-party companies Percona integrated, absorbing new algorithms and storage engines that are now 5.6.26

3) 6.0.XX to 7.x.xx product series

Mainly in order to better promote the MySQL cluster version, provide cluster version of the performance and stability, this version is less company use, because it is too late

MySQL Installation

Production environment How to choose MySQL version

1: Select the stable version of the GA version of the community

2: Product line, mainly 5.1 and 5.5, most 5.5

3: Choose MySQL GA version released for 6 months or more

4: It is best to back a longer period of time without updating the published version

5: Compatible with developers using versions

6: Test environment run for 3-6 months

7: To the production environment non-core business run for several months

MySQL Installation Method

1: Install using binary mode,Rpm/yum

2: source code compilation, product line 1 with the normal compilation installation, line 2 with cmake compiled installation 5.5/6/7

3: Batch deployment,src.rpm through spec file

Environment: Centos6.5x86-64 (This is the context of this document, but in fact includes but is not limited to), pre-configured local and online yum source, ready for MySQL's source package (this article mysql-5.5.32)

The source code compiles installs the common compile installs, has given the detailed process in the Nginx, this article will focus on the MySQL CMake compilation installs, takes the mysql-5.5.32 as the example.

1. Installing the cmake Compilation tool
Yum Install cmake-y

2. DownloadMySQL
wget http://ftp.ntu.edu.tw/pub/mysql/downloads/mysql-5.5/mysql-5.5.32.tar.gz
3. Installing dependent Packages
Yum Install ncurses-devel–y    // Development Kit for terminal Operation
4. Add Users
8001 -s/sbin/nologin MySQL

5. Create a Database storage directory
mkdir /tar zxf mysql-5.5. . Tar  ~]# cd mysql-5.5.  +
[Email protected] mysql-5.5. +]# Cmake-dcmake_install_prefix=/usr/local/mysql-dmysql_unix_addr=/tmp/mysql.sock-ddefault_charset=utf8-ddefault _collation=utf8_general_ci-dwith_extra_charsets=all-dwith_myisam_storage_engine=1-dwith_innobase_storage_engine=1-dwith_memory_storage_engine=1-dwith_readline=1-denabled_local_infile=1-dmysql_datadir=/data-dmysql_user=Mysqlutf8-ddefault_collation=utf8_general_ci-dwith_extra_charsets=all-dwith_myisam_storage_engine=1-dwith_innobase_storage_engine=1-dwith_memory_storage_engine=1-dwith_readline=1-denabled_local_infile=1-dmysql_datadir=/data-dmysql_user=mysql
[Email protected] mysql-5.5.  +  Make 4  Make Install 4
// using 4 CPU cores, such as our dual core four thread, can write 4

Parameter description:

-dcmake_install_prefix data File storage directory

-dmysql_unix_addr sock file path

-ddefault_charset default Character Set

-ddefault_collation Default character proofing

-dwith_extra_charsets Extended character support default All

-dwith_storage_storage_engine Storage Engine support , Myisam,merge,memory,cvs storage engine is supported by default

-denabled_local_infile=1 enable loading of local data

-dmysql_datadir Data Storage directory

-dmysql_user MySQL running user

Extended:

-dwith_partition_storage_engine=1 Support Partition Table

-dinstall_libdir=Dir_name

-dsysconfdir=dir_name The default my.cnf option file directory

7. Authorized Users
[Email protected] mysql-5.5.  + chown -R mysql:mysql/usr/local/mysql/[[email protected] MySQL-5.5.  chown -R mysql:mysql/data[[email protected] MySQL-5.5.  chmod1777 /tmp

8. Create a configuration file
[Email protected] mysql-5.5.  + CP SUPPORT-FILES/MY-LARGE.CNF/ETC/MY.CNF

9. Setting Environment variables
[Email protected] mysql-5.5.  + Echo ' export Path=/usr/local/mysql/bin: $PATH ' >>/etc/profile[[email protected] MySQL-5.5.  ]# Source!$

10. Create a service startup script to add boot start
[Email protected] mysql-5.5. +]#CPsupport-files/mysql.server/etc/init.d/mysqld [[email protected] MySQL-5.5. +]#chmod+x/etc/init.d/mysqld//Add execute permissions to a script[Email protected] mysql-5.5. +]# vim/etc/init.d/mysqld//service startup script to modify the following two parametersBasedir=/usr/local/mysql//MySQL installation directoryDatadir=/data//Data Storage Directory[[email protected] MySQL-5.5. +]# Chkconfig mysqld on//Add boot boot

11. Initializing the database
[Email protected] mysql-5.5.  + chmod
[Email protected] mysql-5.5. +] #/usr/local/mysql/scripts/mysql_install_db--defaults-file

// see two OK on success

12. Initialize the Security Configuration
[email protected] mysql-5.5.  ]#  Service mysqld start  // start MySQL services. [email protected] mysql-5.5.  ]# service  mysqld  status// view MySQL service state [[email protected] mysql-5.5 .  + ]#  mysql_secure_installation  Security initialization configuration //  Note: Be sure to start the MySQL service before initializing the security configuration 

13. Creating Users and databases
[email protected] mysql-5.5.32]# mysql-u root- PEnter password:welcome to the MySQL Monitor. Commands End With; or \g.your MySQL connectionIDIs +Server Version:5.5. +-Log Source distributioncopyright (c) -, -, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or Itsaffiliates. Other names trademarks of their respectiveowners. Type'Help ;'Or'\h'  forHelp. Type'\c'ToClearThe current input statement. MySQL > Grant all privileges on * * to [email protected] '% ' identified by ' 123456 ' with GRANT option;
Create the permissions that the system user has given it to log on on any server. % stands for arbitrary server. LocalHost can only log on on this computer.

14. Test if MySQL is installed successfully

Create a game database and log in with a third-party tool on the host with the system user

Create Database game;

OK, the test succeeds, indicating that my previous MySQL database CMake compiled and installed successfully.

Open Source Service topics--------MySQL compilation and installation

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.