Centos6安装mysql5.7
1、上传mysql-5.7.21-1.el6.x86_64.rpm-bundle.tar到linux系统
2、解压到相应文件夹 tar -xvf mysql-5.7.21-1.el6.x86_64.rpm-bundle.tar -C 文件夹路径
解压后的文件:
mysql-community-libs-5.7.21-1.el6.x86_64.rpm
mysql-community-devel-5.7.21-1.el6.x86_64.rpm
mysql-community-server-5.7.21-1.el6.x86_64.rpm
mysql-community-test-5.7.21-1.el6.x86_64.rpm
mysql-community-embedded-5.7.21-1.el6.x86_64.rpm
mysql-community-client-5.7.21-1.el6.x86_64.rpm
mysql-community-libs-compat-5.7.21-1.el6.x86_64.rpm
mysql-community-common-5.7.21-1.el6.x86_64.rpm
mysql-community-embedded-devel-5.7.21-1.el6.x86_64.rpm
3、创建用户组,将用户加入用户组
groupadd mysql
useradd -g mysql 用户名
4、安装
执行rpm -qa | grep -i mysql查看是否存在内容,存在就执行rpm -e --nodeps 文件名
rpm -ivh mysql-community-common-5.7.21-1.el6.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.21-1.el6.x86_64.rpm
rpm -ivh mysql-community-client-5.7.21-1.el6.x86_64.rpm
rpm -ivh mysql-community-server-5.7.21-1.el6.x86_64.rpm
5、启动(两次)
service mysqld start
查看mysql状态:service mysqld status
6、登录
查看初始密码:grep 'temporary password' /var/log/mysqld.log
mysql -uroot -p
登录成功之后,设置用户、密码:alter user '用户名'@'localhost' identified by '密码';
记录本次操作,便于以后遗忘时查询