mysql開啟skip-name-resolve 導致[email protected](localhost)訪問引發的ERROR 1045 (28000)錯誤解決方案

来源:http://www.cnblogs.com/hongsm/archive/2017/12/04/7978624.html
-Advertisement-
Play Games

為什麼配置skip-name-resolve? 由於mysql -h${ip} 遠程訪問速度過慢, 根據網友經驗(https://www.cnblogs.com/yjf512/p/3803762.html), 重啟mysql,發現遠程訪問msyql速度上來了,解決問題。 然而引發了新的問題: 但是卻 ...


為什麼配置skip-name-resolve?

由於mysql -h${ip} 遠程訪問速度過慢,

mysql -h172.16.66.171 -uroot -p123456

 根據網友經驗(https://www.cnblogs.com/yjf512/p/3803762.html),

vi /etc/my.cnf

[mysqld] skip
-name-resolve

重啟mysql,發現遠程訪問msyql速度上來了,解決問題。

 然而引發了新的問題:

但是卻發現msyql(mysql -h127.0.0.1 -uroot -p123456)無法本地訪問:

[root@localhost ~]#  mysql -h127.0.0.1 -uroot -p123456
Warning: Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'127.0.0.1' (using password: YES)

而不輸入密碼(mysql -h127.0.0.1 -uroot)卻可以訪問。

[root@localhost ~]#   mysql -h127.0.0.1 -uroot 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 91114
Server version: 5.6.35-log MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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>

 

解決方法:

參考(http://blog.sina.com.cn/s/blog_759a5a7c01017dj0.html),重置root密碼:

[root@localhost ~]#   mysql -h127.0.0.1 -uroot 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 91114
Server version: 5.6.35-log MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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> use mysql;
Database changed
mysql> update user set password=password("123456") where user="root";
Query OK, 3 rows affected (0.06 sec)
Rows matched: 5  Changed: 3  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.13 sec)

mysql> quit
Bye
[root@localhost ~]# 

 用 mysql -h127.0.0.1 -uroot -p123456 訪問,問題解決。

[root@localhost ~]# mysql -h127.0.0.1 -uroot -p123456
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2487
Server version: 5.6.35-log MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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>

 由於開啟skip-name-resolve引發的ERROR 1045 (28000)網上資料不詳,解決這個問題花了大半天,所以發佈這篇文章。

My first blog on cnblogs!


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 上次已經講了《Hive數據倉庫之快速入門一》不記得的小伙伴可以點擊回顧一下,接下來我們再講Hive數據倉庫之快速入門二 DQL hive中的order by、distribute by、sort by和cluster by order by 全局排序,只有一個Reduce任務 sort by 只做j ...
  • 1、插入數據 1.1 插入完整數據記錄 語法1: 例子: 語法2: 例子: 1.2 插入數據記錄一部分 語法: 例子: 1.3 插入多條數據記錄 1、插入多條完整的數據 語法: 例子: 插入多條部分數據記錄 例子: 1.3 插入查詢結果 例子: 向資料庫company中的部門表(t_dept)插入表 ...
  • 錯誤Caused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch updateORA-02291: 違反完整約束條件 (UNISPOWER.FK932556A9840256A ...
  • 這個系列大致想跟大家分享以下篇章(我會持續更新的↖(^ω^)↗): 1、mongo 3.4分片集群系列之一:淺談分片集群 2、mongo 3.4分片集群系列之二:搭建分片集群--哈希分片 3、mongo 3.4分片集群系列之三:搭建分片集群--哈希分片 + 安全 4、mongo 3.4分片集群系列之 ...
  • 解決power designer 不能自動生成註釋的解決辦法只需要3步: 一、快捷鍵 Ctrl+Shift+X 打開腳本編輯器;(快捷鍵不能執行的話可以從這個路徑執行:Tools --> Excute commands --> Edit/Run Script) 二、將下麵天藍色的字體腳本添加到腳本編 ...
  • - 清空全部數據,不寫日誌,不可恢復,速度極快 truncate table_name; -- 清空全部數據,寫日誌,數據可恢復,速度慢 delete from 表名 詳情請查看區別 ...
  • mysql -u root -p -u:username -p:password 1.庫級操作: show databases; 顯示所有資料庫 create database a; drop database a; //從刪庫到跑路 2.表操作: use a; create table users ...
  • 今天跟大家來聊聊Mysql,首先介紹一下它的歷史: Mysql是一個關係型資料庫管理系統,最先由瑞典的MySQL AB公司開發,後來被sun公司收購,後因sun公司又被Oracle公司收購,致使MySQL現在成為Oracle旗下產品,MySQL資料庫現在被業界廣泛使用。 使用方法和案列: 1) My ...
一周排行
    -Advertisement-
    Play Games
  • 示例項目結構 在 Visual Studio 中創建一個 WinForms 應用程式後,項目結構如下所示: MyWinFormsApp/ │ ├───Properties/ │ └───Settings.settings │ ├───bin/ │ ├───Debug/ │ └───Release/ ...
  • [STAThread] 特性用於需要與 COM 組件交互的應用程式,尤其是依賴單線程模型(如 Windows Forms 應用程式)的組件。在 STA 模式下,線程擁有自己的消息迴圈,這對於處理用戶界面和某些 COM 組件是必要的。 [STAThread] static void Main(stri ...
  • 在WinForm中使用全局異常捕獲處理 在WinForm應用程式中,全局異常捕獲是確保程式穩定性的關鍵。通過在Program類的Main方法中設置全局異常處理,可以有效地捕獲並處理未預見的異常,從而避免程式崩潰。 註冊全局異常事件 [STAThread] static void Main() { / ...
  • 前言 給大家推薦一款開源的 Winform 控制項庫,可以幫助我們開發更加美觀、漂亮的 WinForm 界面。 項目介紹 SunnyUI.NET 是一個基於 .NET Framework 4.0+、.NET 6、.NET 7 和 .NET 8 的 WinForm 開源控制項庫,同時也提供了工具類庫、擴展 ...
  • 說明 該文章是屬於OverallAuth2.0系列文章,每周更新一篇該系列文章(從0到1完成系統開發)。 該系統文章,我會儘量說的非常詳細,做到不管新手、老手都能看懂。 說明:OverallAuth2.0 是一個簡單、易懂、功能強大的許可權+可視化流程管理系統。 有興趣的朋友,請關註我吧(*^▽^*) ...
  • 一、下載安裝 1.下載git 必須先下載並安裝git,再TortoiseGit下載安裝 git安裝參考教程:https://blog.csdn.net/mukes/article/details/115693833 2.TortoiseGit下載與安裝 TortoiseGit,Git客戶端,32/6 ...
  • 前言 在項目開發過程中,理解數據結構和演算法如同掌握蓋房子的秘訣。演算法不僅能幫助我們編寫高效、優質的代碼,還能解決項目中遇到的各種難題。 給大家推薦一個支持C#的開源免費、新手友好的數據結構與演算法入門教程:Hello演算法。 項目介紹 《Hello Algo》是一本開源免費、新手友好的數據結構與演算法入門 ...
  • 1.生成單個Proto.bat內容 @rem Copyright 2016, Google Inc. @rem All rights reserved. @rem @rem Redistribution and use in source and binary forms, with or with ...
  • 一:背景 1. 講故事 前段時間有位朋友找到我,說他的窗體程式在客戶這邊出現了卡死,讓我幫忙看下怎麼回事?dump也生成了,既然有dump了那就上 windbg 分析吧。 二:WinDbg 分析 1. 為什麼會卡死 窗體程式的卡死,入口門檻很低,後續往下分析就不一定了,不管怎麼說先用 !clrsta ...
  • 前言 人工智慧時代,人臉識別技術已成為安全驗證、身份識別和用戶交互的關鍵工具。 給大家推薦一款.NET 開源提供了強大的人臉識別 API,工具不僅易於集成,還具備高效處理能力。 本文將介紹一款如何利用這些API,為我們的項目添加智能識別的亮點。 項目介紹 GitHub 上擁有 1.2k 星標的 C# ...