欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

centos 7.4安装mysql

程序员文章站 2022-06-11 16:14:01
...

1.下载安装包

wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

2.运行安装包

yum -y install mysql57-community-release-el7-10.noarch.rpm

3.安装数据库,这步可能会花些时间,安装完成后就会覆盖掉之前的mariadb。

yum -y install mysql-community-server
4.启动服务

systemctl start mysqld.service

5.找密码

grep “password” /var/log/mysqld.log

内容如下:

2019-10-16T04:24:00.078079Z 1 [Note] A temporary password is generated for [email protected]  

localhost: oQ+-SPrhh4Bu

6.登录mysql并输入密码

mysql -uroot -p

7.修改密码

ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘123456’;
如果报:Your password does not satisfy the current policy requirements
可以查看:https://blog.csdn.net/wudinaniya/article/details/79378635的详解

8.修改远程访问密码

grant all privileges on . to ‘root’@’%’ identified by ‘123456’ with grant option;

flush privileges;

相关标签: centos7.4安装mysql