服务器之家:专注于服务器技术及软件下载分享
分类导航

Mysql|Sql Server|Oracle|Redis|MongoDB|PostgreSQL|Sqlite|DB2|mariadb|

服务器之家 - 数据库 - Mysql - Centos7使用yum安装Mysql5.7.19的详细步骤

Centos7使用yum安装Mysql5.7.19的详细步骤

2020-08-14 18:09沧月V587 Mysql

本篇文章主要介绍了Centos7使用yum安装Mysql5.7.19的详细步骤,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧

Centos7的yum源中默认是没有mysql,因为现在已经用mariaDB代替mysql了。

首先我们下载mysql的repo源,我们可以去mysql官网找最新的repo源地址

Centos7使用yum安装Mysql5.7.19的详细步骤

地址:

https://dev.mysql.com/downloads/repo/yum/

开始在linux下下载repo源

?
1
2
3
4
5
6
7
8
//下载mysql rpm包
# wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
 
//安装mysql rpm包
# rpm -ivh mysql57-community-release-el7-11.noarch.rpm
 
//安装mysql
# yum install mysql-community-server

安装成功后需要重启mysql服务。

?
1
# service mysqld restart

刚开始安装的Mysql5.7是会随机生成一个root密码的,我们要先找到这个随机密码,然后改新密码。我们可以通过grep命令查找随机root密码。

?
1
2
[root@local bin]# grep "password" /var/log/mysqld.log
2017-09-24T08:03:30.664086Z 1 [Note] A temporary password is generated for root@localhost: 8A3xwbk8_P1A

使用随机密码登录mysql

?
1
2
[root@local bin]# mysql -uroot -p
Enter password:

进入后重置root密码

?
1
2
mysql> SET password=PASSWORD("mysql123");
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

如果有上面的报错,说明密码设置的过于简单。密码设置规则是要有数字大小写字母和字符串。

最后授予外网登录权限,username为用户名,password是登录密码

?
1
mysql>grant all privileges on *.* to username@'%' identified by 'password';

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。

原文链接:http://www.jianshu.com/p/155a5c468f06?utm_source=tuicool&utm_medium=referral

延伸 · 阅读

精彩推荐