centos6.9下安装mysql5.7,使用rpm包安装

1、查看系统版本
lsb_release -a

2、卸载old mysql
rpm -qa|grep -i mysql

rpm -ev MySQL-client-5.5.25a-1.rhel5 如果提示依赖错误,增加–nodeps
find / -name mysql
rm -rf /var/lib/mysql
rm -rf /var/lib/mysql
rm -rf /usr/lib64/mysql
rm -rf /etc/my.cnf
rpm -qa|grep -i mysql

3、下载mysql,如果是centos6系列一定要el6,不然出现glibc安装错误
wget http://mirror.centos.org/centos/6/os/x86_64/Packages/numactl-2.0.9-2.el6.x86_64.rpm

tar -xvf mysql-5.7.16-1.el6.x86_64.rpm-bundle.tar

4、安装基础包
yum install gcc gcc-c++ ncurses-devel perl

wget http://mirror.centos.org/centos/6/os/x86_64/Packages/numactl-2.0.9-2.el6.x86_64.rpm
#这个包在安装server提示libnuma.so.1

5、安装mysql(顺序:common-libs-client-server,里面compat,test,devel,embedded根据需要安装)
rpm -ivh mysql-community-common-5.7.18-1.el6.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.16-1.el6.x86_64.rpm
rpm -ivh mysql-community-client-5.7.16-1.el6.x86_64.rpm
rpm -ivh mysql-community-server-5.7.16-1.el6.x86_64.rpm
(遇到问题error: Failed dependencies:
libnuma.so.1()(64bit) is needed by mysql-community-server-5.7.16-1.el6.x86_64)
yum install libnuma.so.1 安装后的包是numactl-2.0.9-2.el6.i686.rpm,问题依旧,经分析后重新下载 yum -y install libnuma.so.1.x86_64,原因估计是系统不兼容i686,重新编译安装,成功!)
6、启动服务
service mysqld start
7、查看root 临时密码
grep ‘temporary password’ /var/log/mysqld.log

8、修改root密码
mysql -uroot -p
ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘MyNewPass4!’;
设置用户 root 可以在任意 IP 下被访问:
grant all privileges on . to root@”%” identified by “新密码”;
设置用户 root 可以在本地被访问:
grant all privileges on . to root@”localhost” identified by “新密码”;
刷新权限使之生效:
flush privileges;

阅读更多
文章标签: mysql rpm 操作系统
个人分类: Mysql
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭