报错原因:ERROR 1045 (28000): Access denied for user 'ippbx_admin'@'localhost' (using password: YES)。

8.0.16版本与先前的一些版本添加用户有些改变,一行指令就搞定。演示如下:

ysql> create user 'admin'@'%' identified with caching_sha2_password by 'xhai-123'

-> ;

Query OK, 0 rows affected (0.26 sec)

mysql> select user,host,authentication_string,plugin from mysql.user;

+------------------+-----------+------------------------------------------------------------------------+-----------------------+

| user | host | authentication_string | plugin |

+------------------+-----------+------------------------------------------------------------------------+-----------------------+

| admin | % | $A$005$q0{3bD]bt#>R9SeXb6Z4OS5mdwruFXD7TdiNzovrbbuI5xVxQGOSyKnL5 | caching_sha2_password |

| aplan | % |B2E0C40A5667BF1783A28667466E1399EB00FBDF | mysql_native_password |

| ippbx_admin | 127.0.0.1 | $A$005$g^8x#aXm)T7{n94IvOO8/gPE7qqaVivgEIZ.oh/nrSVG8JCNJfskJBu6j22r. | caching_sha2_password |

| mysql.infoschema | localhost | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password |

| mysql.session | localhost | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password |

| mysql.sys | localhost | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password |

| root | localhost | $A$005$wcJW

k,I\WN.&L+T%V4QQKnlXTx21I/fXRAaWPOco0PgVi6Md3KzdNjZKBB0 | caching_sha2_password |

+------------------+-----------+------------------------------------------------------------------------+-----------------------+

8 rows in set (0.01 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.20 sec)

mysql> exit

Bye

root@root:/b# mysql -u admin -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 42

Server version: 8.0.16 MySQL Community Server - GPL

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit

Bye

可以发现以不限制登录主机的方式可以成功。

数据库中有一个ippbx_admin用户,我们使用insert into 方式添加(insert into user(host,user) values("127.0.0.1","ippbx_admin");),尝试登录却没能成功:

root@root:/b# mysql -u ippbx_admin -p

Enter password:

ERROR 1045 (28000): Access denied for user 'ippbx_admin'@'localhost' (using password: YES)

可以发现使用localhost的默认解析,而数据库中的是127.0.0.1,先前也没注意这个问题,浪费了好久时间,于是改变数据库中host字段为localhost

mysql> update user set host="localhost" where user= "ippbx_admin";

Query OK, 1 row affected (0.17 sec)

Rows matched: 1 Changed: 1 Warnings: 0

mysql> exit

Bye

root@root:/b# mysql -u ippbx_admin -p

Enter password:

ERROR 1045 (28000): Access denied for user 'ippbx_admin'@'localhost' (using password: YES)

发现还是没能登录,之后我们使用alter 去修改密码,注意'ippbx_admin'@'localhost' 需要与数据库保持一致

mysql> alter user 'ippbx_admin'@'localhost' identified with caching_sha2_password by 'xhai-123';

Query OK, 0 rows affected (0.13 sec)

神奇的发现可以登录了,nice

root@root:~# mysql -u ippbx_admin -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 60

Server version: 8.0.16 MySQL Community Server - GPL

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

相关指令使用:

1、select user,host,authentication_string,plugin from mysql.user;#查看用户信息,user表中不在使用password字段,改为使用authentication_string,取值参考如下;

The caching_sha2_password and sha256_password authentication plugins provide more secure password encryption than the mysql_native_password plugin, and caching_sha2_password provides better performance than sha256_password. Due to these superior security and performance characteristics of caching_sha2_password, it is as of MySQL 8.0 the preferred authentication plugin, and is also the default authentication plugin rather than mysql_native_password.

2、GRANT ALL PRIVILEGES ON . TO 'ippbx_admin'@'localhost' WITH GRANT OPTION;#授予test账户所有权限.

PS:相同的密码在数据库中存储了不同的值,账户应该更加安全。

mysql8.0新用户无法连接_mysql 8.0.16 Linux新建用户无法登录相关推荐

  1. linux新建用户和权限,linux 新建用户和权限分配

    1.创建新用户:testuser 命令:#useradd 选项 用户名 选项: -c comment 指定一段注释性描述. -d 目录 指定用户主目录,如果此目录不存在,则同时使用-m选项,可以创建主 ...

  2. linux给普通用户赋予scp权限,关于linux新建用户并赋予文件夹权限和scp权限的问题...

    当前用户是aaa,新建用户bbb: $adduser bbb 赋予sudo权限(即把用户bbb添加到sudo组): $usermod -a -G sudo bbb 切换到bbb: $su - bbb ...

  3. linux新建用户,用户组,以及权限的分配(摘自博客园)

    linux新建用户,用户组,以及权限的分配 原文url:https://www.cnblogs.com/clicli/p/5943788.html Linux 系统是一个多用户多任务的分时操作系统,任 ...

  4. linux新建用户退格键(删除键)无法正常使用的问题总结

    Linux新建用户配置 1.现象 如图,按退格键(Backspace).删除键出现 '^H' 符号,tab键也不能自动拼写 这是新用户下的普通bash配置都没有,从root用户处copy过来即可 2. ...

  5. mysql8.0版本的服务器名称_MySQL 8.0安装部署-运维笔记

    MySQL 8 正式版 8.0.11 已发布,官方表示 MySQL 8 要比 MySQL 5.7 快 2 倍,还带来了大量的改进和更快的性能! 一.  Mysql8.0版本相比之前版本的一些特性 1) ...

  6. mysql权限控制禁止用户远程连接_mysql权限控制—新建用户允许其远程连接

    mysql为了保证安全性,在默认情况下,只允许在本地登录,在日常工作中,经常会需要用户远程连接使用该数据库,因此便需要创建新的用户,给其分配相应的权限,如下: 注:关键字都应该大写,尽量养成好习惯 创 ...

  7. mysql允许用户远程连接_mysql允许用户远程连接

    一,安装MySQL 这个应该很简单了,而且我觉得大家在安装方面也没什么太大问题,所以也就不多说了,下面我们来讲讲配置. 二,配置MySQL 注意,在Ubuntu下MySQL缺省是只允许本地访问的,如果 ...

  8. mysql允许两个用户远程连接_mysql允许用户远程连接

    一,安装MySQL 这个应该很简单了,而且我觉得大家在安装方面也没什么太大问题,所以也就不多说了,下面我们来讲讲配置. 二,配置MySQL 注意,在Ubuntu下MySQL缺省是只允许本地访问的,如果 ...

  9. linux 新建用户、用户组 以及为新用户分配权限

    最近项目中使用hadoop  一开始在linux下的root用户上做试验 现在转到hadoop用户下 所以要新建hadoop用户了 直接入主题: Linux 系统是一个多用户多任务的分时操作系统,任何 ...

最新文章

  1. WIN2008 R2 Active Directory 之一 部署企业中第一台Windows Ser
  2. 怎样学好C语言,一个成功人士的心得!
  3. tableau实战系列(九)-用 ZN 函数处理数据缺失点
  4. opencv清晰度,色偏等评价函数
  5. 程序员修神之路--做好分库分表其实很难之二
  6. Android 学习 笔记_03. SQLite的使用
  7. 芈珺:iOS自动化测试工具总览
  8. 记录一次nginx502/504问题解决过程
  9. python 相对导入_Python相对导入机制详解
  10. document.getElementsByName , document.getElementsByTagName ,document.createElement
  11. day_4 Selenium请求库
  12. 【求助】想知道Xcode怎么像devc一样调试程序
  13. python计算器界面设计_Python 计算器界面设计
  14. Uhuntu搜狗拼音输入法安装详细过程
  15. win7共享文件服务器设置密码,Win7局域网共享文件夹添加密码保护文件安全的方法...
  16. c#语言开发app,C#开发Android App--03--创建第一个app--Hello World
  17. Zotero: 扩容
  18. 第一课:jquery入门
  19. java生成avl文件_AVL文件扩展名 - 什么是.avl以及如何打开? - ReviverSoft
  20. 设计模式6--适配器模式

热门文章

  1. 使用 TypeScript 自定义装饰器给类的方法增添监听器 Listener
  2. Service Worker 概念简介
  3. SAP Spartacus cxFocus的config属性的赋值原理
  4. Angular应用bootstrap时的version检测机制
  5. 使用OData服务创建SAP C4C的Lead数据,必须指定Account字段
  6. local sandbox getBootstrapScriptPath
  7. bubble click event handling
  8. 2015-03-19 header note update in my Appointment
  9. How to get ABAP code coverage result
  10. product thumbnail区域未能显示的原因分析