centos7通过rpm离线包安装mysql5.7

卸载自带的mariadb

yum -y remove mariadb-libs.x86_64

mkdir /home/vitess/
cd /home/vitess/
wget http://dev.mysql.com/get/mysql-5.7.27-1.el7.x86_64.rpm-bundle.tar
tar -xvf mysql-5.7.27-1.el7.x86_64.rpm-bundle.tar

rpm -ivh mysql-community-common-5.7.27-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.27-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.27-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.27-1.el7.x86_64.rpm

启动mysql:

service mysqld start

查看并修改mysql密码

cat /var/log/mysqld.log|grep -n password

查询出来的密码值为A4)p3cfKnFyt,这个密码一定要记住

mysql -u root -p输入刚刚的密码登录

在里面输入

set global validate_password_policy =0;
set global validate_password_length=6;

在执行下面命令将密码修改成123456

alter user root@localhost identified by '`123qwer';

给root开通远程访问权限

GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY '`123qwer';
flush privileges;

设置mysql不区分大小写

vi /etc/my.cnf
最后一行加上下面一句
lower_case_table_names=1
max_connections=512

重启mysql

systemctl restart mysqld

给mysql添加超级管理员vitess

登录mysql执行下面命令

set global validate_password_policy =0;
set global validate_password_length=6;
create user 'vitess'@'%' identified by '`123qwer';
grant all on . to vitess@'%' identified by '`123qwer';
grant all on . to vitess@'%' with grant option;
flush privileges;

关闭和禁用防火墙

systemctl stop firewalld;
systemctl disable firewalld;

上一篇:cnetos7下载tidb离线安装包


下一篇:python笔记3-邮件发送(smtplib)