美文网首页
CentOS 7 安装 mysql 5.7

CentOS 7 安装 mysql 5.7

作者: 082e63dc752b | 来源:发表于2021-01-15 13:26 被阅读0次

下载mysql5.7源安装包

[root@localhost ~]# wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

安装mysql5.7源

[root@localhost ~]# yum localinstall mysql57-community-release-el7-8.noarch.rpm

安装mysql5.7

[root@localhost ~]# yum install mysql-community-server

启动mysql,并将其加入到自启动。

[root@localhost ~]# systemctl start mysqld
[root@localhost ~]# systemctl enable mysqld

mysql5.7之后,安装完会在日志文件中记录一个临时密码

[root@localhost ~]# grep 'password' /var/log/mysqld.log 
2021-01-15T04:16:30.625890Z 1 [Note] A temporary password is generated for root@localhost: 7ekCWLjPda-D

用刚查出来的密码登录mysql

[root@localhost ~]# mysql -u root -p

初次登录,root无权限,需要改密之后才可以正常使用mysql

mysql> alter user 'root'@'localhost' identified by 'MyNewPassword123!';

相关文章

网友评论

      本文标题:CentOS 7 安装 mysql 5.7

      本文链接:https://www.haomeiwen.com/subject/fsaiaktx.html