1.解压缩mysql-5.6.4-m7-tar.zip
2.下载压缩包cmake-xxx.tar.gz
3.安装cmake
./configure --prefix=/usr/cmake_exe
make
yum install bison
4.创建mysql用户及用户组
groupadd mysql
useradd -g mysql mysql(创建用户到用户组)
5.安装mysql
5.1 安装
yum install bison (解决cmake失败的问题)
cd mysql-5.6.20
5.2编译安装
cmake .
make && make install
5.3 cd /usr/local/mysql/到该目录下
chown -R mysql.mysql /usr/local/mysql
5.4 cd /usr/local/mysql/scripts 到该目录下
5.5初始化数据库
./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
6.注册为服务
cd /usr/local/mysql/support-files
#注册服务
cp mysql.server /etc/rc.d/init.d/mysql
#使用默认配置文件
cp my-medium.cnf /etc/my.cnf
#让chkconfig管理mysql服务
chkconfig --add mysql
#开机启动
chkconfig mysql on
7.启动mysql
service mysql start
8.将mysql的bin加入到path中
vi /etc/profile 加入以下内容 保存退出后重新登录
PATH=/usr/local/mysql/bin:$PATH
export PATH
9、配置用户密码和远程访问权限
mysql -uroot
SET PASSWORD = PASSWORD('123456'); GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;