1.安装cmake
    (1)www.cmake.org下载最新包。
    (2)编译安装
        ./bootstrap (第一次安装,如果已安装cmake;可以使用cmake cmake解压目录)
        make
        make install
2.安装MySql
    (1)创建帐号
        groupadd mysql
        useradd -r -g mysql mysql
    (2)解压并编译安装
        tar zxvf mysql-VERSION.tar.gz
        cd mysql-VERSION
        // cmake [-DCMAKE_INSTALL_PREFIX=dir_name -DDEFAULT_CHARSET=charset_name -DDEFAULT_COLLATION=collation_name](optional) .
        cmake -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci .
        (charset: utf8; collation: utf8_general_ci)
        make
        make install
    (3)设置mysql安装目录的归档信息
        cd /usr/local/mysql
        chown -R mysql .
        chgrp -R mysql .
        chown -R root .
        chown -R mysql data
    (5)安装数据库
        scripts/mysql_install_db --user=mysql
    (6)替换my.cnf文件
        cp support-files/my-medium.cnf /etc/my.cnf
    (7)启动MySQL
        nohup bin/mysqld_safe --user=mysql &
        如果启动不成功,执行以下命令:
        cat data/localhost.localdomain.err
        如果出现12步的问题,可能是数据库没有安装成功,重新执行第5步;然后重新执行第7步。
    (8)对于生产环境来说,还需要做以下操作
        ./bin/mysqladmin -u root password 'new-password'
        ./bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
        或
        ./bin/mysql_secure_installation
    (9)设置系统启动时,启动MySQL
        cp support-files/mysql.server /etc/init.d/mysql
        chmod +x /etc/init.d/mysql
        chkconfig --add /etc/init.d/mysql
    (10)创建用户并授权远程访问
        ./bin/mysql -u root -p (进入mysql命令行)    
        insert into mysql.user(host, user, password) values ("localhost", "mysql", password("123456"));
        grant all privileges on *.* to 'mysql'@'%' identified by '123456';
        flush privileges;
    (11)配置iptables,开放mysql端口
        vi /etc/sysconfig/iptables
        在COMMIT前,添加下面这句话:
            -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
        service iptables save
        service iptables restart
    (12)解决以下问题
        (10.1)/usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist
        (10.2)[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
        
        出现以上问题,是由于mysql_install_db安装不对,请重新安装。
        
        
        
    注:1.查找mysql_install_db的位置
        find / -name mysql_install_db
        
        
    Installing MySQL system tables...
    OK
    Filling help tables...
    OK
    
    To start mysqld at boot time you have to copy
    support-files/mysql.server to the right place for your system
    
    PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
    To do so, start the server, then issue the following commands:
    
    ./bin/mysqladmin -u root password 'new-password'
    ./bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
    
    Alternatively you can run:
    ./bin/mysql_secure_installation
    
    which will also give you the option of removing the test
    databases and anonymous user created by default.  This is
    strongly recommended for production servers.
    
    See the manual for more instructions.
    
    You can start the MySQL daemon with:
    cd . ; ./bin/mysqld_safe &
    
    You can test the MySQL daemon with mysql-test-run.pl
    cd ./mysql-test ; perl mysql-test-run.pl
    
    Please report any problems with the ./bin/mysqlbug script!