//报错

ERROR 2003 (HY000): Can't connect to MySQL server on'localhost'(111)'

1)更改配置,此处可以跳过密码设置

vi /etc/my.cnf

#在mysqld模块下添加

skip-grant-tables

// password 函数在MySQL8中位置,以下步骤未实现

2)重启服务:

systemctl restart mysqld

3) 按照传统改密码方式发现没有 password这个字段。

mysql> update user set password=password('123') where user='root';

ERROR 1054 (42S22): Unknown column 'password' in 'field list'

网上查了一下据说5.7 版本password 字段改成authentication_string password函数未知

mysql> update user set authentication_string=password('123') where user='root';

Query OK, 1 row affected, 1 warning (0.00 sec)

Rows matched: 1 Changed: 1 Warnings: 1

user 表的管理字段

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

| Field | Type | Null | Key | Default | Extra |

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

| Host | char(255) | NO | PRI | | |

| User | char(32) | NO | PRI | | |

| Select_priv | enum('N','Y') | NO | | N | |

| Insert_priv | enum('N','Y') | NO | | N | |

| Update_priv | enum('N','Y') | NO | | N | |

| Delete_priv | enum('N','Y') | NO | | N | |

| Create_priv | enum('N','Y') | NO | | N | |

| Drop_priv | enum('N','Y') | NO | | N | |

| Reload_priv | enum('N','Y') | NO | | N | |

| Shutdown_priv | enum('N','Y') | NO | | N | |

| Process_priv | enum('N','Y') | NO | | N | |

| File_priv | enum('N','Y') | NO | | N | |

| Grant_priv | enum('N','Y') | NO | | N | |

| References_priv | enum('N','Y') | NO | | N | |

| Index_priv | enum('N','Y') | NO | | N | |

| Alter_priv | enum('N','Y') | NO | | N | |

| Show_db_priv | enum('N','Y') | NO | | N | |

| Super_priv | enum('N','Y') | NO | | N | |

| Create_tmp_table_priv | enum('N','Y') | NO | | N | |

| Lock_tables_priv | enum('N','Y') | NO | | N | |

| Execute_priv | enum('N','Y') | NO | | N | |

| Repl_slave_priv | enum('N','Y') | NO | | N | |

| Repl_client_priv | enum('N','Y') | NO | | N | |

| Create_view_priv | enum('N','Y') | NO | | N | |

| Show_view_priv | enum('N','Y') | NO | | N | |

| Create_routine_priv | enum('N','Y') | NO | | N | |

| Alter_routine_priv | enum('N','Y') | NO | | N | |

| Create_user_priv | enum('N','Y') | NO | | N | |

| Event_priv | enum('N','Y') | NO | | N | |

| Trigger_priv | enum('N','Y') | NO | | N | |

| Create_tablespace_priv | enum('N','Y') | NO | | N | |

| ssl_type | enum('','ANY','X509','SPECIFIED') | NO | | | |

| ssl_cipher | blob | NO | | NULL | |

| x509_issuer | blob | NO | | NULL | |

| x509_subject | blob | NO | | NULL | |

| max_questions | int(11) unsigned | NO | | 0 | |

| max_updates | int(11) unsigned | NO | | 0 | |

| max_connections | int(11) unsigned | NO | | 0 | |

| max_user_connections | int(11) unsigned | NO | | 0 | |

| plugin | char(64) | NO | | caching_sha2_password | |

| authentication_string | text | YES | | NULL | |

| password_expired | enum('N','Y') | NO | | N | |

| password_last_changed | timestamp | YES | | NULL | |

| password_lifetime | smallint(5) unsigned | YES | | NULL | |

| account_locked | enum('N','Y') | NO | | N | |

| Create_role_priv | enum('N','Y') | NO | | N | |

| Drop_role_priv | enum('N','Y') | NO | | N | |

| Password_reuse_history | smallint(5) unsigned | YES | | NULL | |

| Password_reuse_time | smallint(5) unsigned | YES | | NULL | |

| Password_require_current | enum('N','Y') | YES | | NULL | |

| User_attributes | json | YES | | NULL | |

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

51 rows in set (0.01 sec)

4.更改配置重启

[root@master1 ~]# vi /etc/my.cnf

注释 # skip-grant-tables

[root@master1 ~]# systemctl restart mysqld

[root@master1 ~]# mysql -uroot -p123

5.成功:

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

Your MySQL connection id is 10

Server version: 8.0.18 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>

yum mysql 设置密码_Linux下的 Mysql 8.0 yum 安装 并修改密码相关推荐

  1. linux php mysql 中文_Linux下PHP+MySQL+CoreSeek中文检索引擎配置 | 系统运维

    说明: 操作系统:CentOS 5.X 服务器IP地址:192.168.21.127 Web环境:Nginx+PHP+MySQL 站点根目录:/usr/local/nginx/html 目的:安装co ...

  2. liunx下搭建mysql主从_linux下搭建mysql主从

    在master上创建repl账户,用于复制. grant replication slave on *.* to [email protected]%' identified by 'P@$$W0rd ...

  3. linux配置mysql数据库_Linux下配置mysql数据库

    1 linux下安装mysql数据库 1.将安装包上传到linux目录下 /usr/local/wollo 2.使用 tar命令在当前目录下解压mysql 解压命令为: [root@bogon wol ...

  4. linux mysql失败_linux下登陆mysql失败

    标签: 一.提示由于没有密码,拒绝登陆 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: N ...

  5. mysql5.7 mysql库下面的user表没有password字段无法修改密码

    如题所述,mysql5.7  mysql库下面的user表没有password字段无法修改密码, 5.7版本已经不再使用password来作为密码的字段了  而改成了authentication_st ...

  6. Mysql学习篇之---Windows环境下安装 (修改密码)

    Mysql学习篇之---Windows环境下安装 (修改密码) 前言: 自己瞎鼓捣本机上的Mysql,结果导致mysql密码用那个都登录不进去了. 解决方案: 首先把mysql重新删除掉,重新解压了一 ...

  7. python3.7安装步骤-Windows下Python 3.7.0的安装步骤,Python370

    Windows下Python 3.7.0的安装步骤 由于Python版本太新的话,能会出现不稳定的情况,所以在这里,作者建议用版本不太新的Python.在这里,我用的是Python3.7.0版本(其他 ...

  8. centos 安装mysql客户端_linux下mysql的yum源安装/配置/卸载

    yum源安装 解决:赋予root权限 首先停止MySQL服务:service mysqld stop 加参数启动mysql:/usr/bin/mysqld_safe --skip-grant-tabl ...

  9. mysql linux设置密码_Linux下第一次使用MySQL数据库,设置密码

    在终端下输入:/etc/rc.d/init.d/mysqld status 查看MySQL状态,看看是否运行. 没有运行的话就输入:/etc/rc.d/init.d/mysqld start 这时,就 ...

  10. liunx mysql模块_linux下安装MySQLdb模块_MySQL

    bitsCN.com linux下安装MySQLdb模块 1,查看是否已安装MySQLdb模块 进入python的命令行,输入 import MySQLdb 如果没有报错,证明此模块已经安装,可以跳过 ...

最新文章

  1. hdu 1312 Red and Black 解题报告
  2. 维基链超级节点竞选开展如火如荼
  3. [剑指offer][JAVA]面试题第[07]题[重建二叉树][递归]
  4. 区块链必读的书_最好的区块链:5条必读
  5. python客户端修改session_Python接口自动化之cookie、session应用
  6. 搜索、推荐、广告中的曝光偏差问题
  7. 想成为优秀的技术人员你必须做到的几件事情【转载】
  8. pycharm添加python注释头_pycharm使用教程——py文件自动添加文件头注释
  9. 免费中文api文档!免费java帮助文档api中文版!!!!!
  10. 安装ie11提示计算机安装了更新的版本,离线安装IE11浏览器提示quot;获取更新quot;解决方法 - 191路由网...
  11. Qt 5.2.1 applications (32 bit) in CentOS (64 bit with gcc 4.8.2)
  12. 一生必看的经典电影(转载)
  13. mac php 单元测试,PHPUnit单元测试
  14. 代写演讲稿的写作要求有哪些
  15. PDF各种格式相互转换
  16. Python开发图形可视化界面程序(一)
  17. picpick文字竖排了怎么变成横排
  18. Windows7系统速度慢 或是颜色校正惹祸
  19. MATLAB神经网络编程(六)——BP神经网络的训练函数
  20. 深信服2022校招C++二面

热门文章

  1. C语言栈的push函数,关于栈的有关问题。为什么Push函数top始终是NULL
  2. php根据ajax传值跳转页面_vue中动态路由的跳转(name | path) 前进后退 replace...
  3. 两个excel表格信息合并 自动匹配_别再复制黏贴了,合并两个Excel表格可以很简单!...
  4. 小蜜蜂(动态规划dp)
  5. 文本分类之一:语言模型
  6. RSA 数字签名 免密码登录
  7. u9系统的使用方法仓库_windows7电脑系统远程桌面命令的使用方法
  8. 计算机视觉SLAM方向顶会
  9. python如何执行代码_在Python中重新运行代码块
  10. 前轮转向最大角度设计原来_转向系统的工作原理