Install MySQL under Linux using CMake

Source: Internet
Author: User

Original address: http://www.cppblog.com/issay789/archive/2013/01/05/196967.html

First, install the M4

: http://files.w3pc.com/download/mysql/m4-1.4.16.tar.gz

Second, installation Bison

: http://files.w3pc.com/download/mysql/bison-2.7.tar.gz

Third, installation CMake

: Http://files.w3pc.com/download/mysql/cmake-2.8.10.2.tar

Iv. installation of MySQL

: http://files.w3pc.com/download/mysql/mysql-5.5.23.tar.gz

First, install the M4\bison\cmake

Download File

wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz

or wget Http://files.w3pc.com/download/mysql/cmake-2.8.10.2.tar

Compile the installation (install the M4\bison method as follows )

       
       tar zxvf cmake-2.8.5.tar.gz
       cd cmake-2.8.5
      . Bootstarp (This command executes, otherwise it skips)
       make
       make Install
       cmake--version

         Two, install the configuration MySQL

        download File

       wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.14.tar.gz/ from/ftp://ftp.ntu.edu.tw/pub/mysql/

or wget http://files.w3pc.com/download/mysql/mysql-5.5.23.tar.gz

set Linux auto-match environment variables

1. $su #su进入root

#vi/etc/profile

          Add the following statement at the end of the file:
          path= $PATH:/sbin                       # Append/sbin directory after path variable
          export  path= $PATH:/sbin          # set Variable to global
          Save and exit.
          exit root and run at Terminal
           $source/etc/profile                       #该命令的作 Use to re-execute the initialization file you just modified so that it takes effect immediately without having to log out and re-login in the terminal enter Ifconfig              create users and Groups


       Groupadd mysql    //build a MSYQL user and group
       useradd-g mysql mysql-s/usr/sbin/nologin
        mkdir/usr/local/mysql        //Creating a directory
       mkdir/usr/local/mysql/data    //Data Warehouse directory

        Install MySQL

       tar-zxvf mysql-5.5.14.tar.gz
        CD mysql-5.5.14
       cmake-dcmake_install_prefix=/usr/local /mysql

       ps:cmake, parameters can be used for as little as one-dcmake_install_prefix=/usr/ Local/mysql on the line, we can configure it in MY.CNF. [Mysqld] In the content, see your copy after the my.cnf have these settings, there is no need to set up.  &NBSP

       make && make install
      
If you need to change the configuration:

Make clean
Rm-f CMakeCache.txt

Copying a configuration file

CP SUPPORT-FILES/MY-MEDIUM.CNF/USR/LOCAL/MYSQL/MY.CNF

Set Permissions

chmod +x/usr/local/mysql
Chown-r Mysql:mysql/usr/local/mysql

Configure boot-up

Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql
chmod +x/etc/init.d/mysql
Chkconfig--list
UPDATE-RC.D MySQL defaults (/sbin/chkconfig--add mysql;/sbin/chkconfig MySQL on)
Chkconfig--add MySQL
Chkconfig MySQL on
Chkconfig--list MySQL

Modifying the MY.CNF configuration

Gedit/usr/local/mysql/my.cnf
[Mysqld] Add:
Datadir=/usr/local/mysql/data
Default-storage-engine=myisam
 The following options are available:

Log-error =/usr/local/mysql/mysql_error.log
Pid-file =/usr/local/mysql/mysql.pid
user = MySQL
Tmpdir =/tmp

Installing the default data table

/usr/local/mysql/scripts/mysql_install_db--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data--user=mysql

start MySQL

/usr/local/mysql/bin/mysqld_safe--DEFAULTS-FILE=/USR/LOCAL/MYSQL/MY.CNF &
The last "&" means running in the background, or using/etc/init.d/mysql start (service MySQL start)

set mysql command line path
The path to the MySQL command is below/usr/local/mysql/bin, so when you use the MySQL command directly, the system checks the command under/usr/bin.
The solution is: ln-s/usr/local/mysql/bin/mysql/usr/bin

test if MySQL is started

1) See if there is a process MySQL
Ps-ef | grep MySQL

2) See if the port is running
NETSTAT-TNL | grep 3306

3) Read MySQL version information
/usr/local/mysql/bin/mysqladmin version

At this point, the MySQL installation is complete.

third, error resolution
1.libstdc++.so dependency problem: Use the command yum install GCC

Iv. References

http://laiguowei2004.blog.163.com/blog/static/3682900020117834131998/
Http://hi.baidu.com/reducm/blog/item/1ad30a2b71e691215243c13d.html
Http://www.cnblogs.com/vicowong/archive/2011/01/27/1946453.html
http://noohou.sinaapp.com/

Install MySQL under Linux using CMake

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.