1、 下载mysql源安装包
shell> wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
2、安装mysql源
shell> yum localinstall mysql57-community-release-el7-8.noarch.rpm
3、检查mysql源是否安装成功
shell> yum repolist enabled | grep "mysql.*-community.*"
4、安装mysql
shell> yum install mysql-community-server
5、启动mysql
shell> systemctl start mysqld
6、查看mysql的启动状态
7、开机启动
shell> systemctl enable mysqld
shell> systemctl daemon-reload
8、修改root本地登录密码
mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个默认密码。通过下面的方式找到root默认密码,然后登录mysql进行修改:
shell> grep 'temporary password' /var/log/mysqld.log
shell> mysql -u root -p
登录成功后修改密码:
set password=password("yourpassword");
9、重新启动mysql服务使配置生效:
systemctl restart mysqld
10、配置mysql远程连接
mysql -uroot -p
输入密码登陆,
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
flush privileges;
qq:1992093891