手记

centos7.2安装mysql5.7

首先安装mysql5.7的rpm

rpm -Uvh http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm

安装mysql

yum install mysql-community-server

运行mysqld

systemctl start mysqld

查看mysqld的运行状态和一些初始化的提示 systemctl status mysqld
查看初始密码

grep "password" /var/log/mysqld.log

2018-08-15T06:46:46.786449Z 1 [Note] A temporary password is generated for root@localhost: gYRxfWRlv5+i

连接mysql mysql -uroot -pgYRxfWRlv5+i
这时候不能做其他操作,需要先设置我们自己的密码
SET PASSWORD = PASSWORD('');
授权远程访问

grant all privileges on . to root@"%" identified by "";

flush priviledges;

服务器必须打开3306端口访问才可以

0人推荐
随时随地看视频
慕课网APP