1. 安装cmake
1) download from: http://www.cmake.org/files/v2.8/cmake-2.8.12.tar.gz 并解压
2) 编译安装
# ./bootstrap # make # make install
# tar xvf mysql-5.5.30.tar.gz # cd mysql-5.5.30/ # cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 # make # make install
1) 添加mysql用户
# useradd mysql # passwd mysql
2) 更改mysql目录属主
# chown mysql.mysql /usr/local/mysql -R # chown mysql.mysql /usr/local/mysql/data -R3) 复制配置文件
# cp /home/duanbb/open-source/mysql-5.5.30/support-files/my-large.cnf /etc/my.cnf4) 复制启动脚本并设置开机启动
# cp /home/duanbb/open-source/mysql-5.5.30/support-files/mysql.server /etc/init.d/mysql # chmod +x /etc/init.d/mysql # chkconfig --add mysql5) 初始化数据库
# /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql6) 启动数据库
# /etc/init.d/mysql start7) 设置root密码
/usr/local/mysql/bin/mysqladmin -u root password "mysql"8) 验证登录是否成功
/usr/local/mysql/bin/mysql -uroot -pmysql9) 设置环境变量
编辑/etc/profile,在文件末加入
export PATH=$PATH:/usr/local/mysql/bin