首先,下载mysql-5.7.10-1.el6.x86_64.rpm-bundle.tar
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.10-1.el6.x86_64.rpm-bundle.tar tar -xvf mysql-5.7.10-1.el6.x86_64.rpm-bundle.tar
你也可以到mysql的官方网站下载:http://dev.mysql.com/downloads/
安装依赖
yum install numactl
下载完了之后进入到相应目录,执行下面的命令
rpm -ivh mysql-community-common-5.7.10-1.el6.x86_64.rpm mysql-community-libs-5.7.10-1.el6.x86_64.rpm mysql-community-client-5.7.10-1.el6.x86_64.rpm mysql-community-server-5.7.10-1.el6.x86_64.rpm mysql-community-devel-5.7.10-1.el6.x86_64.rpm
然后执行下面命令初始化,执行生会在/var/log/mysqld.log生成随机密码,最后一行可以看到
mysqld --initialize
最后别忘了启动mysqld服务,更改root密码,设置开机启动和映射管道文件(php将默认使用/tmp/mysql.sock)
chown -R mysql.mysql /var/lib/mysql service mysqld start /usr/bin/mysqladmin -u root -p'你的初始化密码' password '你的新密码' chkconfig mysqld on ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock