腾讯云mysql安装

1、下载安装指令

  • -P指定路径
  • -i从指定文件获取要下载的URL地址;
  • -c继续执行上次终端的任务;断点续传
wget -P /opt/mysql  -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

1.2.安装rpm

  • -y 自动选择 y
  • install 全部安装
yum -y install mysql57-community-release-el7-10.noarch.rpm

1.3.安装mysql服务

yum -y install mysql-community-server 

如出错:Error: Unable to find a match: mysql-community-server
禁用本地mysql模块在执行

yum module disable mysql

报错:GPG check FAILED加上–nogpgcheck在执行

yum install mysql-community-server  --nogpgcheck

1.4.启动服务

systemctl start  mysqld.service

1.5.查看状态

systemctl status mysqld.service

1.6.获取临时密码

grep "password" /var/log/mysqld.log
A temporary password is generated for root@localhost:这里是密码

2.登录使用MySQL

2.1控制台登录

输入临时密码登录

mysql -u root -p

2.2修改密码

set password for 'root'@'localhost'=password('xxxxxx');

上面指令的root是用户名称,xxxxxx是密码,写一个自己记得住的。密码必须要包含大小写字符和数字,特殊字符也可以用,太简单会提示错误:Your password does not satisfy the current policy

2.3查询数据库访问权限

默认MySQL远程的数据库是仅能localhost访问,使用navicat等工具连接就会提示1130 - Host 'xxx.xxx.xx.xxx' is not allow to connect to this MySQL server,如果需要远程访问,需要修改权限

use mysql;
select * from user;

2.4查询数据库访问权限

更新User 表 Host 字段为 ‘%’,代表所有远程主机。

update user set Host='%' where User='root'; 

刷新权限

flush privileges;

3.重置密码

登录报错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

3.1、跳过MySQL的密码认证

vim /etc/my.cnf

在[mysqld]后面任意一行添加

skip-grant-tables

保存后重启

systemctl restatus mysqld.service

3.2登录mysql修改

mysql -u root
mysql> update mysql.user set Password=password('新密码') where User='root';
mysql> flush privileges;
mysql> quit

如出现:ERROR 1054 (42S22): Unknown column 'password' in 'field list'
Password字段不存在修改为authentication_string

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值