MySQL5.5.52 Compiling and installing

Source: Internet
Author: User
Tags mysql version

First, MySQL Introduction
MySQL is a relational database management system developed by the Swedish MySQL AB company, currently owned by the Oracle company. MySQL's most popular relational database management system, MySQL is one of the best RDBMS (relational database Management system, relational databases management systems) application software in WEB applications.
MySQL is an associated database management system that keeps data in separate tables rather than putting all of the data in a large warehouse, which increases speed and increases flexibility.
The SQL language used by MySQL is the most commonly used standardized language for accessing databases. MySQL software uses a dual licensing policy, which is divided into community and commercial version, due to its small size, fast, low total cost of ownership, especially the open source, the development of the general small and medium-sized web site to choose MySQL as the site database.

Second, the MySQL version selection
Tip 1. Select version GA version, development version, alpha version and beta version are generally not used in the project. Because they must have significant problems or some features are not fully implemented.
Tip 2. Select the GA version, do not select the latest, generally select the first 3-4 versions or 10 months ago.
Tip 3. See the official note, no major bug update version

Three, Installation introduction
MySQL uses the CMake installation method starting from 5.3.
This version selects the MySQL5.5 series with the most users, giving the 5.5.52 and the latest
MySQL5.5 Department
Http://dev.mysql.com/downloads/mysql/5.5.html#downloads

Iv. Preparation before installation
Current system

[Email protected] ~]# cat/etc/redhat-release CentOS release 6.8 (Final) [[email protected] ~]# uname-r2.6.32-642.el6.x86 _64[[email protected] ~]# uname-mx86_64[[email protected] ~]# UNAME-NDB01

1. Upload the required MySQL compilation installation package
You can use RZ,FTP and other tools to upload to the specified directory;
Demo: My store directory user's home directory

[[email protected] ~]# mkdir-p/server/tools[[email protected] ~]# cd/server/tools[[email protected] tools]# rzrz waitin G to receive.  Starting Zmodem transfer. Press CTRL + C to cancel.  Transferring mysql-5.5.52.tar.gz ... 100% 20539 KB 20539 kb/sec 00:00:01 0 Errors [[email protected] tools]# [Root[email protected] tools]# ll total use Volume 20540-rw-r--r--1 root root 21032776 August 17:32 mysql-5.5.52.tar.gz

2. Installing CMake Tools
MySQL installs with CMake tool starting from 5.3
CMake Tool Address https://cmake.org/files/v3.5/cmake-3.5.2.tar.gz
Demonstrate:
1) Download Tool

[Email protected] tools]# pwd/server/tools[[email protected] tools]# wget https://cmake.org/files/v3.5/ cmake-3.5.2.tar.gz [[email protected] tools]# ls-l cmake-3.5.2.tar.gz-rw-r--r--1 root root 6863498 April 01:40 cmake-3 .5.2.tar.gz

2) Unzip the cmake3.5.2

[Email protected] tools]# tar xf cmake-3.5.2.tar.gz [[email protected] tools]# ls-ld cmake-3.5.2drwxr-xr-x root root 4096 April 09:45 cmake-3.5.2

3) Install cmake3.5.2

[Email protected] tools]# CD Cmake-3.5.2[[email protected] cmake-3.5.2]#./configure [[email protected] cmake-3.5.2]# GM Ake[[email protected] cmake-3.5.2]# gmake install[[email protected] cmake-3.5.2]# CD. /

PS: If you are in trouble then Yum can also be installed (Yum install-y cmake)

[email protected] tools]# Yum install-y cmake


3, installation Ncurses-devel dependent
ncurses, computer language, refers to the provision of character terminal processing libraries.

[email protected] tools]# Yum install-y ncurses-devel


4. Install MySQL
1) Create Users and Groups

[[email protected] tools]# useradd-ms/sbin/nologin mysql[[email protected] tools]# ID mysqluid=501 (mysql) gid=501 (MySQL ) group =501 (MySQL)

2) Unzip the build installation

[[email protected] tools]# tar xf mysql-5.5.52.tar.gz [[email protected]  tools]# cd mysql-5.5.52[[email protected] mysql-5.5.52]# cmake . - dcmake_install_prefix=/application/mysql-5.5.52 -dmysql_datadir=/application/mysql-5.5.52/data - Dmysql_unix_addr=/application/mysql-5.5.52/tmp/mysql.sock -ddefault_charset=utf8 -ddefault_collation =utf8_general_ci -dextra_charsets=gbk,gb2312,utf8,ascii -denabled_local_infile=on -dwith_ innobase_storage_engine=1 -dwith_federated_storage_engine=1 -dwith_blackhole_storage_engine=1 - dwithout_example_storage_engine=1 -dwithout_partition_storage_engine=1 -dwith_fast_mutexes=1 - dwith_zlib=bundled -denabled_local_infile=1 -dwith_readline=1 -dwith_embedded_server=1 - Dwith_debug=0 ......... ............ To omit ... oaded-virtual -wno-unused-parameter-- cmake_c_flags_relwithdebinfo: -o2 -g ..... .....????????????.  -dndEbug -ddbug_off -dmy_pthread_fastmutex=1-- cmake_cxx_flags_relwithdebinfo: -o2 -g  -dndebug -ddbug_off -dmy_pthread_fastmutex=1-- configuring done-- generating  done-- build files have been written to: /server/tools/mysql-5.5.52  [[email protected] mysql-5.5.52]# echo $?0

<== displayed as result configuration succeeded

parameter explanation:

cmake . -dcmake_install_prefix=/application/mysql-5.5.52 \  #指定安装目录-dmysql_datadir=/ application/mysql-5.5.52/data \   #指定数据存放目录 (important)-dmysql_unix_addr=/application/mysql-5.5.52/tmp/ mysql.sock \  #指定sock的路径-ddefault_charset=utf8 \                      #指定默认字符集-ddefault_collation=utf8_ general_ci \         #指定校准字符集编码-dextra_charsets=gbk,gb2312,utf8, ascii \     #安装所需字符集-denabled_local_infile=on \                      #启用加载本地数据-dwith_ innobase_storage_engine=1 \            # Supports Innode storage engine-dwith_federated_storage_engine=1 \              #支持federated引擎-dwith_blackhole_storage_engine=1 \          #支持黑洞储存引擎-dwithout_example _storage_engine=1 -dwithout_partition_storage_engine=1 \          #安装支持数据库分区-dwith_fast_mutexes=1 -dwith_zlib=bundled \                         # Zlib compression Mode-denabled_local_infile=1 -dwith_readline=1 -dwith_embedded_server=1 -dwith_debug=0                                   #禁用debug, enabling impact performance

Hint, there are many options for compiling at compile time, refer to official document at the end
3) Compile and install

[[email protected] mysql-5.5.52]# make ................. Omitted................................. [100%] Built target My_safe_process[[email protected] mysql-5.5.52]# echo $?0<== compilation successful [[email protected] mysql-5.5.52]# make Install ......... ............ Omit ...---Installing:/application/mysql-5.5.52/man/man1/mysqlslap.1--Installing:/application/mysql-5.5.52, ..... .....--------- /man/man8/mysqld.8[[email protected] mysql-5.5.52]# echo $?0<== installation succeeded

If there is no error in the above operation, the installation of MySQL5.5.52 software CMake mode is successful.
4) Create a soft connection to remove the version number

[Email protected] mysql-5.5.52]# ln-s/application/mysql-5.5.52//application/mysql

5. Copy the MySQL configuration file into/etc directory

[Email protected] mysql-5.5.52]# \CP/APPLICATION/MYSQL/SUPPORT-FILES/MY-SMALL.CNF/ETC/MY.CNF

6. Configure Environment variables

[Email protected] mysql-5.5.52]# echo ' export path=/application/mysql/bin: $PATH ' >>/etc/profile[[email Protected] mysql-5.5.52]# tail-1/etc/profileexport path=/application/mysql/bin: $PATH [[email protected] mysql-5.5.52 ]# Source/etc/profile[[email protected] mysql-5.5.52]# echo $PATH/application/mysql/bin:/usr/local/sbin:/usr/local/ Bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

7. Give the directory user group

[Email protected] mysql-5.5.52]# chown-r mysql.mysql/application/mysql/

8. Execute the Database initialization script

[[email protected] mysql-5.5.52]# cd /application/mysql/scripts/[[email protected]  scripts]# ./mysql_install_db > --basedir=/application/mysql-5.5.52 > -- datadir=/application/mysql-5.5.52/data > --user=mysqlinstalling mysql system  Tables ... 161210 15:00:47 [note] /application/mysql-5.5.52/bin/mysqld  (mysqld 5.5.52)   STARTING&NBSP;AS&NBSP;PROCESS&NBSP;21047&NBSP, ..... Okfilling help tables ... 161210 15:00:48 [note] /application/mysql-5.5.52/bin/mysqld  (mysqld 5.5.52)   STARTING&NBSP;AS&NBSP;PROCESS&NBSP;21054&NBSP, ..... okto start mysqld at boot time you have to copysupport-files/ Mysql.server to the right place for your systemplease remember to  set a password for the mysql root user ! to do so, start the server, then issue the following commands:/application/ mysql-5.5.52/bin/mysqladmin -u root password  ' New-password '/application/mysql-5.5.52/bin/ mysqladmin -u root -h db01 password  ' New-password ' Alternatively you  can run:/application/mysql-5.5.52/bin/mysql_secure_installationwhich will also give  You the option of removing the testdatabases and anonymous user  created by default.  this isstrongly recommended for production  servers. See the manual for more instructions. you can start the mysql daemon with:cd /application/mysql-5.5.52 ;  /application/mysql-5.5.52/bin/mysqld_safe &You can test the MySQL  daemon with mysql-test-run.plcd /application/mysql-5.5.52/mysql-test ; perl mysql-test-run.plplease report any problems at  http://bugs.mysql.com/

Two OK above indicates initialization of database complete
9. Configure Start MySQL

[[Email protected] scripts]# CD [[email protected] ~]# cp/application/mysql/support-files/mysql.server/etc/init.d/ Mysqld[[email protected] ~]# chmod +x/etc/init.d/mysqld[[email protected] ~]# sed-i ' s#/usr/local/mysql#/application/ Mysql#g '/application/mysql/bin/mysqld_safe/etc/init.d/mysqld[[email protected] ~]#/etc/init.d/mysqld Startstarting MySQL ... success!

Start error

#/etc/init.d/mysqld start

(1) Start File Save

/etc/init.d/mysqld:line 276:CD:/usr/local/mysql: No file or directory starting MySQL error! Couldn ' t find MySQL server (/usr/local/mysql/bin/mysqld_safe)

Solve:

Sed-i ' S#/usr/local/mysql#/application/mysql#g '/application/mysql/bin/mysqld_safe/etc/init.d/mysqld

(2) MySQL start error

/etc/init.d/mysqld Start error: [[email protected] mysql]#/etc/init.d/mysqld startstarting MySQL. error! The server quit without updating PID file (/var/lib/mysql/mysql.pid).

Problem: MySQL initialization error
Solve:
1. Clear the Data directory

Rm-f/application/mysql/data/*

2. reinitialization of MySQL

/application/mysql/scripts/mysql_install_db--user=mysql--basedir=/application/mysql--datadir=/application/ mysql/data/

3. Then re-operate from the steps after the initialization step

Netstat-lntup|grep MySQL

10. Join the boot start

[[email protected] ~]# chkconfig mysqld on[[email protected] ~]# chkconfig--list mysqldmysqld 0: Off 1: off 2: Enabled 3: Enable 4: Enable 5: Enable 6: Off

11. Check the port

[Email protected] ~]# Netstat-lntup | grep 3306tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 21333/mysqld

Here the MySQL database is installed O (∩_∩) o~~!!!

This article is from the "Hyun-dimensional" blog, please be sure to keep this source http://xuanwei.blog.51cto.com/11489734/1881478

MySQL5.5.52 Compiling and installing

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.