准备环境:Centos6.5(6系列操作系统)
[[email protected] ~]# yum -y install gcc gcc-c++ ncurses-devel libxml2-devel zlib-devel pcre-devel
[[email protected] ~]# tar zxvf bison-2.5.tar.gz
[[email protected] ~]# cd bison-2.5
[[email protected] ~]# ./configure &&make &&make install
[[email protected] ~]# tar zxvf cmake-2.8.7.tar.gz
[[email protected] ~]# cd cmake-2.8.7
[[email protected] ~]# ./bootstrap &&gmake &&gmake install
[[email protected] ~]# tar zxvf mysql-5.5.22.tar.gz
[[email protected] ~]# cd mysql-5.5.22
[[email protected] ~]# useradd mysql
[[email protected] ~]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DSYSCONFDIR=/etc/ &&make &&make install
参数注释:安装目录、默认编码、校验字符集、安装所有扩展字符集、配置文件目录
[[email protected] ~]# chown -R :mysql /usr/local/mysql
[[email protected] ~]# cd /usr/local/mysql/support-files
[[email protected] ~]# cp my-medium.cnf /etc/my.cnf
[[email protected] ~]# cp mysql.server /etc/init.d/mysqld
[[email protected] ~]# cd ../scripts/
下面操作将进行mysql初始化,指定基础目录,存放数据目录,及运行用户
[[email protected] ~]# ./mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
[[email protected] ~]# /etc/init.d/mysqld start
[[email protected] ~]# echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
[[email protected] ~]# source /etc/profile
[[email protected] ~]# mysqladmin -u root password ‘redhat‘ 设置mysql运行账户及密码,这个root可不是系统用户的root哦!
[[email protected] ~]# mysql -u root -p
Enter password:
OK,安装完成