CENTOS 6.5 x64 Environment Source compilation installation MYSQL-5.5.38

Source: Internet
Author: User
Tags automake



1. Install the dependent libraries required by the MYSQL server:

bison* gcc* gcc-c++* autoconf* automake* zlib* libxml2* ncurses-devel* libtool-ltdl-devel*

# rpm-ivhlibtool-ltdl-devel-2.2.6-15.5.el6.x86_64.rpm

or:

# yum Install Bison gcc gcc-c++ autoconf automake zlib libxml ncurses-devel libtool-ltdl-devel

2. Install the CMake package required to compile the MYSQL 5.x.x version above :

# Rpm-qa |grep cmake (first check if the system is installed CMake bag)

# cd/mnt/packages

# RPM-IVH cmake-2.6.4-5.el6.x86_64.rpm

or:

# wget http://wwwNaNake.org/files/v2.8/cmake-2.8.6.tar.gz

# tar ZXVF cmake-2.8.6.tar.gz

# CD CMAKE-2.8.6/

#./configure

# Gmake

# gmake Install

3. Create MYSQL Users and groups, create data store directories and log store directories, and set permissions:

# Groupadd MySQL

# useradd-g mysql-s/sbin/nologin MySQL

# mkdir-p/data/mysql

# Chown-r Mysql:mysql/data/mysql

# mkdir-p/data/mysql_log

# Chown-r Mysql:mysql/data/mysql_log

4. Compile and install the MYSQL 5.5.22 server:

# CD/USR/LOCAL/SRC

# wget http://down1.chinaunix.net/distfiles/mysql-5.5.38.tar.gz (if you have downloaded the source code package you will not have to download it)

# tar ZXVF mysql-5.5.38.tar.gz

# CD mysql-5.5.38

# cmake-dcmake_install_prefix=/usr/local/mysql-dsysconfdir=/etc-dmysql_datadir=/data/mysql-dmysql_tcp_port=3306 -dmysql_unix_addr=/tmp/mysqld.sock-ddefault_charset=utf8-ddefault_collation=utf8_general_ci-dmysql_user=mysql

# Gmake

# gmake Install

5. set up the MYSQL server configuration file:

# Cd/usr/local/mysql

# CP./support-files/my-huge.cnf/etc/my.cnf

# VI/ETC/MY.CNF(Add or modify options in different configuration areas depending on your needs)

[Mysqld]

# for GLOBAL

Max_allowed_packet = 100M

Sort_buffer_size = 5M

Read_buffer_size = 5M

Read_rnd_buffer_size = 10M

max_connections = 1000

Skip-name-resolve

# for MYISAM

# for Bin_log and Slow_log

Binlog_format = MIXED

Log_bin =/data/mysql_log/mysql-bin

Log_bin_index =/data/mysql_log/mysql-bin.index

Slow_query_log = On

Long_query_time = 1

Slow_query_log_file =/data/mysql_log/mysql-slow.log

Log_queries_not_using_indexes = On

# for INNODB

Innodb_data_home_dir =/data/mysql

Innodb_data_file_path =ibdata1:100g;ibdata2:100g;ibdata3:100m:autoextend

Innodb_buffer_pool_size = 1024M

Innodb_additional_mem_pool_size = 100M

Innodb_flush_log_at_trx_commit = 2

6. Initialize the database and add the service for the MYSQLD system:

# Cd/usr/local/mysql

#./scripts/mysql_install_db--datadir=/data/mysql--basedir=/usr/local/mysql--defaults-file=/etc/my.cnf--user= Mysql

# CP./support-files/mysql.server/etc/rc.d/init.d/mysqld

# chmod 755/etc/rc.d/init.d/mysqld

# chkconfig--add mysqld

# chkconfig--level mysqld off

7. Set the startup script variable:

# Vi/etc/rc.d/init.d/mysqld

Basedir=/usr/local/mysql

Datadir=/data/mysql

8. Set environment variables:

# Vi/etc/profile (added on the last line of the global profile, all user sessions are valid)

Export path= $PATH:/usr/local/mysql/bin

# . /etc/profile

or:

# Export path= $PATH:/usr/local/mysql/bin (valid in current user session)

9. start the MYSQL service:

# service Mysqld Start

Set the database administrator root password and restart the mysqld Service:

# mysqladmin-u root password ' 123456 '

# Service Mysqld Restart

# Check the MySQL service listening port status:

# Netstat-npalt | grep 3306

TCP 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 19033/mysqld

# View mysql process status:

# Ps-ef | grep MySQL

Root 18769 1 0 14:43 pts/0 00:00:00/bin/sh/usr/local/mysql/bin/mysqld_safe--datadir=/data/mysql--pid-f Ile=/data/mysql/centos1.pid

MySQL 19033 18769 0 14:43 pts/0 00:00:00/usr/local/mysql/bin/mysqld--basedir=/usr/local/mysql--datadir=/data/mys QL--plugin-dir=/usr/local/mysql/lib/plugin--user=mysql

--log-error=/data/mysql/centos1.err--pid-file=/data/mysql/centos1.pid--socket=/tmp/mysqld.sock--port=3306

Log in to the MYSQL server:

# mysql-uroot-p123456

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| Information_schema |

| MySQL |

| Performance_schema |

| Test |

+--------------------+

4 rows in Set (0.00 sec)

mysql> use MySQL;

Database changed

Mysql> Show tables;

+---------------------------+

| Tables_in_mysql |

+---------------------------+

| Columns_priv |

........

Manage MYSQL: Create database libraries, create tables, etc.

# show mysql storage engine:

Mysql> show engines;

# Change Character set:

Mysql> Show variables like ' character_set_% ';

Mysql> set Character_set_client=utf8;


This article from the "Technical Backup" blog, reproduced please contact the author!

CENTOS 6.5 x64 Environment Source compilation installation MYSQL-5.5.38

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.