1.下载mysql
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.12-1.el6.x86_64.rpm-bundle.tar
2. 解压
tar -xf mysql-5.7.12-1.el6.x86_64.rpm-bundle.tar
解压完成后由这么几个文件:
mysql-community-client-5.7.12-1.el6.x86_64.rpm
mysql-community-common-5.7.12-1.el6.x86_64.rpm
mysql-community-devel-5.7.12-1.el6.x86_64.rpm
mysql-community-embedded-5.7.12-1.el6.x86_64.rpm
mysql-community-embedded-devel-5.7.12-1.el6.x86_64.rpm
mysql-community-libs-5.7.12-1.el6.x86_64.rpm
mysql-community-libs-compat-5.7.12-1.el6.x86_64.rpm
mysql-community-server-5.7.12-1.el6.x86_64.rpm
mysql-community-test-5.7.12-1.el6.x86_64.rpm
3.开始安装
根据需要安装:
mysql-community-client-5.7.12-1.el6.x86_64.rpm
mysql-community-common-5.7.12-1.el6.x86_64.rpm
mysql-community-libs-5.7.12-1.el6.x86_64.rpm
mysql-community-server-5.7.12-1.el6.x86_64.rpm
执行安装:
rpm -ivh mysql-community-common-5.7.12-1.el6.x86_64.rpm
4.启动mysql
service mysql start
或者使用如下命令:
/etc/init.d/mysql start
5. 此处没有设置密码,会报错
#1045 - Access denied for user 'root'@'localhost' (using password: NO)
解决方法是用安全方式登录,修改密码即可。
mysql安全方式启动:
mysqld_safe --user=mysql --skip-grant-tabes --skip-networking &
或者
/usr/local/mysql/bin/mysqld_safe --skip-grant-tables &
由于mysql5.7 中mysql.user 表中没有Password字段,用authentication_string 代替即可。
6. 至此mysql安装完成,可用客户端工具连接使用了.