(1)先安装cmake(mysql5.5以后是通过cmake来编译的)
[root@ rhel5 local]#tar -zxv -f cmake-2.8.4.tar.gz [root@ rhel5 local]#cd cmake-2.8.4 [root@ rhel5 cmake-2.8.4]#./configure [root@ rhel5 cmake-2.8.4]#make [root@ rhel5 cmake-2.8.4]#make install
(2)创建mysql的安装目录及数据库存放目录
[root@ rhel5~]#mkdir -p /usr/local/mysql //安装mysql [root@ rhel5~]#mkdir -p /usr/local/mysql/data //存放数据库
(3)创建mysql用户及用户组
[root@ rhel5~]groupadd mysql [root@ rhel5~]useradd -r -g mysql mysql
(4)安装mysql
[root@ rhel5 local]#tar -zxv -f mysql-5.5.10.tar.gz [root@ rhel5 local]#cd mysql-5.5.10 [root@ rhel5 mysql-5.5.10]#cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 [root@ rhel5 mysql-5.5.10]#make [root@ rhel5 mysql-5.5.10]#make install
代码如下:
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '******' WITH GRANT OPTION;