`

Ubuntu 11 下使用cmake进行mysql源码安装

阅读更多

一、安装准备

 

(一)到mysql官网(http://dev.mysql.com/downloads/)下载mysql源码

 

(二)编译安装文件时使用的工具

 

1. cmake
    ----shell> sudo apt-get install cmake cmake-gui
    ----版本:2.8.2


2.GNU make
    ----Ubuntu自带

    ----版本:3.81


3.GCC
    ----Ubuntu自带
    ----版本:4.4.5(官方文档:必须3.2以上)


4.Perl
    ----Ubuntu自带
    ----版本:5.10.1


5.libncurses5-dev (ncurses-devel)

    ----若差了这个包,在cmake的时候会报错。
    ----Debian/Ubuntu上的包名是libncurses5-dev,RedHat和其他版本对应的是ncurses-devel

    ----shell> sudo apt-get install libncurses5-dev


6. bison

    ----可选。没有这个工具,在make的时候会报警告。

    ----shell> sudo apt-get install bison

 

7.chkconfig

    ----后面配置mysql服务自启动的时候需要。

    ----shell> sudo apt-get install chkconfig

 

二、安装

# Preconfiguration setup
shell> groupadd mysql
shell> useradd -r -g mysql mysql
# Beginning of source-build specific instructions
shell> tar zxvf mysql-VERSION.tar.gz
shell> cd mysql-VERSION
shell> cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql

           -DDEFAULT_CHARSET=utf8

           -DDEFAULT_COLLATION=utf8_general_ci

shell> make
shell> make install
# End of source-build specific instructions
# Postinstallation setup
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql

shell> chown -R root .
shell> chown -R mysql data
 

三、启动

/etc/init.d/mysqld start

 

四、便于操作的其他设置

1、 设置开机自启动

shell> cp support-files/my-medium.cnf /etc/mysql/my.cnf
shell> cp support-files/mysql.server /etc/init.d/mysqld

shell> chkconfig mysqld on

2、设置环境变量

在/etc/environment文件的PATH下添加/usr/local/mysql/bin

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics