服务器mysql授权用户 和 修改mysql密码 和 解决Access denied for user 'root'@'localhost' (using password: YES)

服务器mysql授权用户
(1)任意主机以用户root和密码mypwd连接到mysql服务器

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mypwd' WITH GRANT OPTION;
flush privileges;

(2)IP为192.168.133.128的主机以用户myuser和密码mypwd连接到mysql服务器

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.133.128' IDENTIFIED BY 'mypwd' WITH GRANT OPTION; 
flush privileges;

修改本地mysql密码:

set password for root@localhost = password('123');
//或者
ALTER USER "root"@"localhost" IDENTIFIED  BY "你的新密码";

修改所有mysql密码:

set password for root@'%' = password('123');
//或者
ALTER USER "root"@"%" IDENTIFIED  BY "你的新密码";
//或者(mysql8.0)
use mysql;
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '你的密码'; 
FLUSH PRIVILEGES;

如果报错Your password does not satisfy the current policy requirements
先修改密码强度:

set global validate_password_policy=0;

修改密码强度方法二:

查看 mysql 初始的密码策略,
输入语句 “ SHOW VARIABLES LIKE 'validate_password%'; ” 进行查看
首先需要设置密码的验证强度等级,设置 validate_password_policy 的全局参数为 LOW 即可,输入设值语句 “ set global validate_password_policy=LOW; ” 进行设值
设置 validate_password_length 的全局参数,输入设值语句 “ set global validate_password_length=4; ” 进行设值

解决Access denied for user 'root'@'localhost' (using password: YES)
找my.cnf文件,linux在/etc/my.cnf
在[mysqld]后添加skip-grant-tables
使用 set password for设置密码无效,且此后登录无需键入密码
重启MySQL服务器

如果mysql8.0版本报错 Table 'mysql.role_edges' doesn't exist
执行一下(升级一下)

mysql_upgrade -u root -p;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
def draw_stats(self, vals, vals1, vals2, vals3, vals4, vals5, vals6): self.ax1 = plt.subplot(self.gs[0, 0]) self.ax1.plot(vals) self.ax1.set_xlim(self.xlim) locs = self.ax1.get_xticks() locs[0] = self.xlim[0] locs[-1] = self.xlim[1] self.ax1.set_xticks(locs) self.ax1.use_sticky_edges = False self.ax1.set_title(f'Connected Clients Ratio') self.ax2 = plt.subplot(self.gs[1, 0]) self.ax2.plot(vals1) self.ax2.set_xlim(self.xlim) self.ax2.set_xticks(locs) self.ax2.yaxis.set_major_formatter(FuncFormatter(format_bps)) self.ax2.use_sticky_edges = False self.ax2.set_title('Total Bandwidth Usage') self.ax3 = plt.subplot(self.gs[2, 0]) self.ax3.plot(vals2) self.ax3.set_xlim(self.xlim) self.ax3.set_xticks(locs) self.ax3.use_sticky_edges = False self.ax3.set_title('Bandwidth Usage Ratio in Slices (Averaged)') self.ax4 = plt.subplot(self.gs[3, 0]) self.ax4.plot(vals3) self.ax4.set_xlim(self.xlim) self.ax4.set_xticks(locs) self.ax4.use_sticky_edges = False self.ax4.set_title('Client Count Ratio per Slice') self.ax5 = plt.subplot(self.gs[0, 1]) self.ax5.plot(vals4) self.ax5.set_xlim(self.xlim) self.ax5.set_xticks(locs) self.ax5.use_sticky_edges = False self.ax5.set_title('Coverage Ratio') self.ax6 = plt.subplot(self.gs[1, 1]) self.ax6.plot(vals5) self.ax6.set_xlim(self.xlim) self.ax6.set_xticks(locs) self.ax6.yaxis.set_major_formatter(FormatStrFormatter('%.3f')) self.ax6.use_sticky_edges = False self.ax6.set_title('Block ratio') self.ax7 = plt.subplot(self.gs[2, 1]) self.ax7.plot(vals6) self.ax7.set_xlim(self.xlim) self.ax7.set_xticks(locs) self.ax7.yaxis.set_major_formatter(FormatStrFormatter('%.3f')) self.ax7.use_sticky_edges = False self.ax7.set_title('Handover ratio')修改为一张张输出图片
最新发布
06-02
好的,你可以将这段代码修改为: ```python def draw_stats(self, vals, vals1, vals2, vals3, vals4, vals5, vals6, save_path): fig, axs = plt.subplots(4, 2, figsize=(16, 16)) axs[0, 0].plot(vals) axs[0, 0].set_xlim(self.xlim) locs = axs[0, 0].get_xticks() locs[0] = self.xlim[0] locs[-1] = self.xlim[1] axs[0, 0].set_xticks(locs) axs[0, 0].use_sticky_edges = False axs[0, 0].set_title(f'Connected Clients Ratio') axs[1, 0].plot(vals1) axs[1, 0].set_xlim(self.xlim) axs[1, 0].set_xticks(locs) axs[1, 0].yaxis.set_major_formatter(FuncFormatter(format_bps)) axs[1, 0].use_sticky_edges = False axs[1, 0].set_title('Total Bandwidth Usage') axs[2, 0].plot(vals2) axs[2, 0].set_xlim(self.xlim) axs[2, 0].set_xticks(locs) axs[2, 0].use_sticky_edges = False axs[2, 0].set_title('Bandwidth Usage Ratio in Slices (Averaged)') axs[3, 0].plot(vals3) axs[3, 0].set_xlim(self.xlim) axs[3, 0].set_xticks(locs) axs[3, 0].use_sticky_edges = False axs[3, 0].set_title('Client Count Ratio per Slice') axs[0, 1].plot(vals4) axs[0, 1].set_xlim(self.xlim) axs[0, 1].set_xticks(locs) axs[0, 1].use_sticky_edges = False axs[0, 1].set_title('Coverage Ratio') axs[1, 1].plot(vals5) axs[1, 1].set_xlim(self.xlim) axs[1, 1].set_xticks(locs) axs[1, 1].yaxis.set_major_formatter(FormatStrFormatter('%.3f')) axs[1, 1].use_sticky_edges = False axs[1, 1].set_title('Block ratio') axs[2, 1].plot(vals6) axs[2, 1].set_xlim(self.xlim) axs[2, 1].set_xticks(locs) axs[2, 1].yaxis.set_major_formatter(FormatStrFormatter('%.3f')) axs[2, 1].use_sticky_edges = False axs[2, 1].set_title('Handover ratio') plt.tight_layout() plt.savefig(save_path) plt.show() ``` 这样就可以一张张输出图片了,你只需要传入一个保存路径参数 `save_path` 即可。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值