Linux MySQL5.5.x cmake compilation and Installation Details

Source: Internet
Author: User

Next, I will introduce to you the cmake compilation and installation of MySQL5.5.x in Linux. This is my first time installing and compiling mysql in linux. I will share it with you below.

1. Install cmake

The Code is as follows: Copy code

# Make the following preparations for a pure system:
# Debian system
Apt-get-y install gcc libxml2-dev curl screen
Libpng12-dev autoconf libpcre3-dev make cmake bzip2
Libevent-dev patches libjpeg62-dev libcurl4-openssl-dev
Libfreetype6-dev g ++ libtool libncurses5-dev psmisc lrzsz

# Centos System
Yum-y install gcc libxml2-dev curl screen
Libpng12-dev autoconf libpcre3-dev make bzip2
Libevent-dev patches libjpeg62-dev libcurl4-openssl-dev
Libfreetype6-dev g ++ libtool libncurses5-dev psmisc lrzsz

# Manually install cmake if it does not exist
# Download an object
Wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz

# Compile and install
Tar zxvf cmake-2.8.5.tar.gz
Cd cmake-2.8.5
. Boostarp
Make
Make install
Cmake-version

Ii. install and configure mysql

The Code is as follows: Copy code

# Download source files
Wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.17.tar.gz/from/ftp://ftp.ntu.edu.tw/pub/MySQL/
# Or
Wget ftp://ftp.ntu.edu.tw/pub/MySQL/Downloads/MySQL-5.5/mysql-5.5.17.tar.gz

# Creating users and groups
# Create an msyql user and group
Groupadd mysql
Useradd-g mysql-s/usr/sbin/nologin

# Create an installation directory
Mkdir-p/usr/local/webserver/mysql

# Create a database directory
Mkdir-p/home/mysql/3306/data

# Decompress
Tar-zxvf mysql-5.5.17.tar.gz
Cd mysql-5.5.17

# Compile and install mysql
# When cmake is used, there is no need for so many parameters, as long as one-DCMAKE_INSTALL_PREFIX =/usr/local/webserver/mysql is enough. We can configure it in my. cnf. [Mysqld] to see if my. cnf after your copy has these settings.
Cmake-DCMAKE_INSTALL_PREFIX =/usr/local/webserver/mysql
-DMYSQL_DATADIR =/home/mysql/3306/data
-DDEFAULT_CHARSET = utf8
-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_MEMORY_STORAGE_ENGINE = 1
-DWITH_DEBUG = 0

# Install mysql
Make & make install

# If you need to change the configuration
Make clean
Rm-f CMakeCache.txt

# Copy the configuration file
Cp support-files/my-medium.cnf/usr/local/webserver/mysql/my. cnf

# Set permissions
Chmod + x/usr/local/webserver/mysql
Chown-R mysql. mysql/usr/local/webserver/mysql

# Configure auto-start upon startup
Cp/usr/local/webserver/mysql/support-files/mysql. server/etc/init. d/mysql
Chmod + x/etc/init. d/mysql
Chkconfig-list
Update-rc.d mysql ults '/sbin/chkconfig-add mysql;/sbin/chkconfig mysql on'
Chkconfig-list mysql

# Modify my. cnf Configuration
Vim/usr/local/webserver/mysql/my. cnf

# [Mysqld] Add:
Datadir =/home/mysql/3306/data
Default-storage-engine = MyISAM

# Optional values:
Log-error =/home/mysql/3306/data/error. log
Pid-file =/home/mysql/3306/data/mysql. pid
User = mysql
Tmpdir =/tmp

# Install the default data table
/Usr/local/webserver/mysql/scripts/mysql_install_db-basedir =/usr/local/webserver/mysql-datadir =/home/mysql/3306/data-user = mysql

# Start MySQL
/Usr/local/webserver/mysql/bin/mysqld_safe-defaults-file =/usr/local/webserver/mysql/my. cnf &

# Or use
# "&" Indicates running in the background
/Etc/init. d/mysql start (service mysql start)

# Test whether MySQL is started

#1) check whether a mysql process exists
Ps-ef | grep mysql

#2) check whether the port is running
Netstat-tnl | grep 3306

#3) read mysql version information
/Usr/local/webserver/mysql/bin/mysqladmin version

# So far, MySQL installation is complete

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.