CentOS Compilation Install MySQL

Source: Internet
Author: User
Tags openssl

I. mysql5.5.38:http://dev.mysql.com/get/downloads/mysql-5.5/mysql-5.5.38.tar.gz

Two. Original source: http://1567045.blog.51cto.com/1557045/841064

Three. Brief review:

0. Prepare the disk and store the MySQL data file

Installation if the disk is larger than 2t, you need to install Parted,yum search parted yum install xx

    • Fdisk–l First look at the partition, determine the drive letter to be divided such as DEV/SDA
    • Enter parted
    • Parted/dev/sda
    • Makde Label
(parted) Mklabel GPT                                                     warning:the existing disk label ON/DEV/SDA would be destroyed and all data onthis Diskwill is lo St. Want to continue? Yes/no? Yes
    • Make part
(parted) mkpartpartition name? []? Dp1file system type? [Ext2]? Ext3start? 0End? 500GB or 0%  100%
    • View
(parted) Print
    • Delete
RM 1 #rm后面使用分区的号码
    • Formatting
Quit quit parted using the system's MKFS.EXT3/DEV/HDD1
    • Mount
# MOUNT/DEV/HDD2/DP2 DP2 need to create a new folder MAKEDIR-PV/DP2
    • Boot automatic mount settings, previous settings, restart the computer, will be canceled mount
    • Vim/etc/fstab last line joins similar to this/dev/sdb2               /media/bak2                             ext4    defaults        0 0

1. Dependencies Required for installation:

Yum-y install NTP vim-enhanced gcc gcc-c++ Flex bison autoconf automake bzip2-devel ncurses-devel zlib-devel libjpeg-deve L libpng-devel libtiff-devel freetype-devel libxpm-devel gettext-devel  pam-devel libtool Libtool-ltdl OpenSSL Openssl-devel fontconfig-devel libxml2-devel curl-devel  libicu libicu-devel libmcrypt libmcrypt-devel Libmhash Libmhash-devel

2. Installing CMake

#下载Cmake的源码包wget http://www.cmake.org/files/v2.8/cmake-2.8.7.tar.gz# Compile and install the tar zxvf cmake-2.8.7.tar.gzcd cmake-2.8.7. /configuremake && make Install

3. Create the Data folder and create a MySQL user

#创建所需目录mkdir-pv/usr/local/mysql/data# create MySQL user and MySQL group groupadd mysqluseradd-g mysql-s/usr/sbin/nologin MySQL
4.
#解压源码包tar ZXVF mysql-5.5.22.tar.gzcd mysql-5.5.22#cmake compilation Cmake-dcmake_install_prefix=/usr/local/mysql-dmysql_ Datadir=/usr/local/mysql/data-ddefault_charset=utf8-ddefault_collation=utf8_unicode_ci-dwith_readline=1-dwith_ Ssl=system-dwith_embedded_server=1-denabled_local_infile=1-ddefault_collation=utf8_general_ci-dwith_myisam_ storage_engine=1-dwith_innobase_storage_engine=1-dwith_debug=0# installing make && make install# copy configuration file CP support-files/my-medium.cnf/etc/my.cnf# Set permissions chmod +x/usr/local/mysqlchown-r mysql:mysql/usr/local/mysqlchown-r mysql:mysql/usr/local/mysql/data# Configure boot automatically start CP support-files/mysql.server/etc/init.d/mysqldchmod +x/etc/init.d/ Mysqldchkconfig--add mysqldchkconfig mysqld on# Modify the configuration file vim/etc/my.cnf# add in [mysqld]: DataDir =/usr/local/mysql/ Datalog-error =/usr/local/mysql/data/error.logpid-file =/usr/local/mysql/data/mysql.piduser = Mysqltmpdir =/tmp# Save Exit # Initialize database/usr/local/mysql/scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data# manually start Mysqlservice mysqld start# test MySQL boot # see if there is a MySQL process Ps-ef | grep mysql# See if there is a MySQL port NETSTAT-TNLP | grep 3306# add MySQL soft link can use the user directly using Ln-sv/usr/local/mysql/bin/mysql mysqlln-sv/usr/local/mysql/bin/mysqladmin Mysqladminln-sv/usr/local/mysql/bin/mysqldump mysqldump or edit/etc/profile add path= $PATH on the previous line beginning with PATH:/usr/local/ mysql/bin# reread the/etc/profile file. /etc/profile# Test if the Mysql,mysqladmin,mysqldump command is working correctly # read MySQL version information mysqladmin versions
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.