centos mysql安装配置远程访问

包含以下三个部分:mysql安装,mysql密码重置、mysql配置远程访问。

一 centos安装mysql

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、yum -y install mysql-community-server

安装过程如果出现以下错误,可以调用

Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql Importing GPG key 0x5072E1F5: Userid : "MySQL Release Engineering " Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5 Package : mysql57-community-release-el7-10.noarch (@/mysql57-community-release-el7-10.noarch) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql Public key for mysql-community-common-5.7.42-1.el7.x86_64.rpm is not installed Failing package is: mysql-community-common-5.7.42-1.el7.x86_64 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

然后调用yum -y install mysql-community-server重新安装。

4、systemctl start mysqld.service

调用成功后可以使用service mysqld status 查看mysql的状态

转存失败重新上传取消

二 密码重置

1、grep "password" /var/log/mysqld.log (备注:查看默认临时密码)

2、mysql -uroot -p (备注:输入刚刚默认的密码)

3、set global validate_password_policy=0;

4、set global validate_password_length=5;

5、ALTER USER 'root'@'localhost' IDENTIFIED BY '你的新密码' ;

6、 SHOW VARIABLES LIKE 'validate_password%';

 

三 配置远程访问

1、查看数据库

show databases;

切换到系统数据库mysql:use mysql;

查看user的认证信息:Select Host, User, authentication_string from user;

 

授权远程访问:

​grant all privileges on *.* to root@'%'identified by '输入你自己的mysql密码';

 

  • 4
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

良枫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值