1:下载安装cmake (mysql5.5以后是通过cmake来编译的)
2:创建mysql的安装目录及数据库存放目录
#mkdir /usr/mysql //安装mysql
#mkdir /usr/mysql/data //存放数据库
3:创建mysql用户及用户组
#groupadd mysql
#useradd -g mysql -s /bin/
false
-M mysql
4:安装mysql
tar -zxv -f /root/mysql-5.6.26.tar.gz
cd mysql-5.6.26
cmake -DCMAKE_INSTALL_PREFIX=/usr/mysql
-DMYSQL_DATADIR=/usr/mysql/data
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci
-DEXTRA_CHARSETS=
all
-DENABLED_LOCAL_INFILE=1
如果报错则需要安装
yum -y install ncurses-devel
rm -f CMakeCache.txt
make
make install
5:配置MySQL
cd /usr/mysql
chown -R root:mysql .
chown -R mysql:mysql data
6:
cp support-files/my-default
.cnf /etc/my.cnf
7:初始化权限表
scripts/mysql_install_db --user=mysql --basedir=/usr/mysql --datadir=/usr/mysql/data
8:启动MySQL服务
cd /usr/mysql/support-files
cp mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
service mysqld start