精华内容
下载资源
问答
  • Navicat报错:1045-Access denied for user root@localhost(using password:YES)怎么解决 文章目录Navicat报错:1045-Access denied for user root@localhost(using password:YES)怎么解决前言解决办法 前言 ...

    Navicat报错:1045-Access denied for user root@localhost(using password:YES)怎么解决

    前言

    • 数据库好久没用过了,某一天打开Navicat,结果连接时报错:1045-Access denied for user root@localhost(using password:YES),我一脸懵逼,也没动过什么啊。没办法,只有盘他。
    • 结果百度发现出现这种问题的还不少,但我搞了几天,看了很多解决办法也没解决我的问题,甚至问题更加严重了,很是苦恼。于是闲置了一个月,想想也不是办法,终于,在昨天解决了,耶,在此记录一下,希望能够帮助到一些CSDNer。
    • 看了很多方法,总结一下出现这种情况的原因;
    1. 有两个mysql,检查一下电脑是否有没有卸载干净的mysql
    2. root权限问题;

    解决办法

    解决办法就是重置root权限密码,但网上很多说在my.ini配置文件下加skip-grant-tables还是行不通,甚至找不到my.ini这个文件。为了大家不再踩我当初的雷,直接上教程。

    1.删除mysql服务

    • 以管理员身份运行cmd,进入mysql的bin文件下,运行命令:
      sc delete MySql
      在这里插入图片描述
    • MySql必须和你的服务名称一致,可以在我的电脑-属性-服务中查看(我的是已经修改过后的,所以不一样)。删除mysql服务之后,在服务中就看不到了,如果还能看见,可以手动右击选择“停止”,服务就消失了。
      在这里插入图片描述

    2.新建my.ini配置文件

    • 在mysql目录下,原来是没有my.ini这个配置文件的,其实,新版的mysql的my.ini配置文件已经迁移到默认C盘下的ProgramData中,这时我们可以选择把它复制到mysql根目录下,但要注意修改my.ini文件中的basedir 和 datadir改成自己正确的路径。
      在这里插入图片描述
      在这里插入图片描述
    • 如果没有这个配置文件也可以自己新建一个空白的my.ini,复制以下代码:
      当然其中的basedir 和 datadir也要相应改变
    # http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
    # *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
    # *** default location during install, and will be replaced if you
    # *** upgrade to a newer version of MySQL.
    [client]
    default-character-set = utf8mb4
    [mysql]
    default-character-set = utf8mb4
    [mysqld]
    character-set-client-handshake = FALSE
    character-set-server = utf8mb4
    collation-server = utf8mb4_bin
    init_connect='SET NAMES utf8mb4'
    # Remove leading # and set to the amount of RAM for the most important data
    # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
    innodb_buffer_pool_size = 128M
    # Remove leading # to turn on a very important data integrity option: logging
    # changes to the binary log between backups.
    # log_bin
    # These are commonly set, remove the # and set as required.
    basedir = D:\MySQL
    datadir = D:\MySQL\data
    port = 3306
    # server_id = .....
    # Remove leading # to set options mainly useful for reporting servers.
    # The server defaults are faster for transactions and fast SELECTs.
    # Adjust sizes as needed, experiment to find the optimal values.
    join_buffer_size = 128M
    sort_buffer_size = 16M
    read_rnd_buffer_size = 16M 
    sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
    

    3.重新生成data文件

    • 删除mysql下的data文件,如果有重要的数据表先备份好。在cmd中重新生成data文件,在data中输入:
      D:\MySql\bin>mysqld --initialize-insecure --user=mysql
      命令执行完毕会在mysql文件夹中生成新的data文件。
      在这里插入图片描述

    4.重新安装mysql服务,同时绑定my.ini配置文件

    在cmd中执行命令:
    D:\MySql\bin>mysqld --install "MySql80" --defaults-file="d:/mysql/my.ini"
    “MySql80”是服务名称,可以自己修改;”…\my.ini“是新建的配置文件的位置,也可以写成绝对路径”D:\MySql\my.ini“。
    在这里插入图片描述
    如果提示安装成功,这时打开电脑的”服务“窗口,可以找到新添加的MySql80服务:
    在这里插入图片描述
    启动mysql:在cmd中输入命令:D:\MySql\bin>net start mysql80,如果启动成功,如下:
    在这里插入图片描述
    如果启动不成功,可能是my.ini配置文件中的某些配置有问题。你可以修改ini文件内容,然后从头按步骤再试一遍。

    5.重新设置密码

    删除了data文件和服务之后,之前的密码就失效了,所以需要重新设置密码。在cmd中输入如下命令:D:\MySql\bin>mysql -u root -p这时密码为空,不用输入密码直接回车。
    在这里插入图片描述

    6.修改root用户密码

    • 在mysql8.0之前的版本,修改root密码的命令是:
      update mysql.user set authentication_string=password("你的密码") where user="root";
    • mysql8.0之后的版本,修改root密码的命令是:
      ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密码';
      在这里插入图片描述
      接着退出mysql,用刚刚修改的密码重新登录,分别运行命令:mysql> exitmysql -u root -p如图:
      在这里插入图片描述
      好了,现在已经成功绑定my.ini文件了,再去打开Navicat就能成功连接了,yeah~开心
      在这里插入图片描述

    后记

    我的文章主要参考以下文章,非常感谢解决了我的问题,最后,希望这篇文章对大家有帮助~~

    参考文章:安装之后没有my.ini配置文件怎么办

    展开全文
  • (using password: NO) when trying to connect,mysqldump: [Warning] Using a password on the command line interface can be insecure,mysqldump 导出报错,linux导出mysql数据库报错mysqldump:got error:1045

    (using password: NO) when trying to connect,mysqldump: [Warning] Using a password on the command line interface can be insecure,mysqldump 导出报错,linux导出mysql数据库报错mysqldump:got error:1045

    mysqld  Ver 5.7.24 for Linux on x86_64 (MySQL Community Server (GPL))

    编辑 mysql 配置文件

    vim /etc/my.cnf

    分析原因:

    • 确认用户名密码没有错误。
    • 密码中含有特殊符号(例如 ~!@$%^&*()_ 等)记住用引号将 "密码包起来,或者考虑换一个密码试试来定位问题。
    展开全文
  • 今天做web应用开发时遇到在使用非谷歌浏览器时,输入localhost:3000,显示如下: 显示需要新应用打开此localhost,实在是没办法显示出网页。 经过反复尝试终于发现问题其实是现在使用非Chrome浏览器,在地址栏输入...

    今天做web应用开发时遇到在使用非谷歌浏览器时,输入localhost:3000,显示如下:

    显示需要新应用打开此localhost,实在是没办法显示出网页。

    经过反复尝试终于发现问题其实是现在使用非Chrome浏览器,在地址栏输入不带http前缀的地址,系统会自动利用百度、或者搜狗直接对当前地址进行搜索,而不是直接进入到当前地址。而Chromeliul浏览器自动就已经将在地址栏输入的内容默认为地址进行处理了,这也是国产浏览器把握住了国产大部分用户在使用浏览器时的搜索行为,将之便利化默认为使用百度搜索等。

    解决方法:在地址前面加入http://即可,如下所示,便能查看到网页内容。

    展开全文
  • 原文:https://letsencrypt.org/docs/certificates-for-localhost/ Last updated: December 21, 2017 |See all ...Sometimes people want to get a certificate for the hostname “localhost”, either fo...

    原文:https://letsencrypt.org/docs/certificates-for-localhost/

    Last updated: December 21, 2017 | See all Documentation

    Sometimes people want to get a certificate for the hostname “localhost”, either for use in local development, or for distribution with a native application that needs to communicate with a web application. Let’s Encrypt can’t provide certificates for “localhost” because nobody uniquely owns it, and it’s not rooted in a top level domain like “.com” or “.net”. It’s possible to set up your own domain name that happens to resolve to 127.0.0.1, and get a certificate for it using the DNS challenge. However, this is generally a bad idea and there are better options.

    For local development

    If you’re developing a web app, it’s useful to run a local web server like Apache or Nginx, and access it via http://localhost:8000/ in your web browser. However, web browsers behave in subtly different ways on HTTP vs HTTPS pages. The main difference: On an HTTPS page, any requests to load JavaScript from an HTTP URL will be blocked. So if you’re developing locally using HTTP, you might add a script tag that works fine on your development machine, but breaks when you deploy to your HTTPS production site. To catch this kind of problem, it’s useful to set up HTTPS on your local web server. However, you don’t want to see certificate warnings all the time. How do you get the green lock locally?

    The best option: Generate your own certificate, either self-signed or signed by a local root, and trust it in your operating system’s trust store. Then use that certificate in your local web server. See below for details.

    For native apps talking to web apps

    Sometimes developers want to offer a downloadable native app that can be used alongside a web site to offer extra features. For instance, the Dropbox and Spotify desktop apps scan for files from across your machine, which a web app would not be allowed to do. One common approach is for these native apps to offer a web service on localhost, and have the web app make requests to it via XMLHTTPRequest (XHR) or WebSockets. The web app almost always uses HTTPS, which means that browsers will forbid it from making XHR or WebSockets requests to non-secure URLs. This is called Mixed Content Blocking. To communicate with the web app, the native app needs to provide a secure web service.

    Fortunately, modern browsers consider “http://127.0.0.1:8000/" to be a“potentially trustworthy”URL because it refers to a loopback address. Traffic sent to 127.0.0.1 is guaranteed not to leave your machine, and so is considered automatically secure against network interception. That means if your web app is HTTPS, and you offer a native app web service on 127.0.0.1, the two can happily communicate via XHR. Unfortunately, localhost doesn’t yet get the same treatment. Also, WebSockets don’t get this treatment for either name.

    You might be tempted to work around these limitations by setting up a domain name in the global DNS that happens to resolve to 127.0.0.1 (for instance, localhost.example.com), getting a certificate for that domain name, shipping that certificate and corresponding private key with your native app, and telling your web app to communicate with https://localhost.example.com:8000/ instead of http://127.0.0.1:8000/.Don’t do this. It will put your users at risk, and your certificate may get revoked.

    By introducing a domain name instead of an IP address, you make it possible for an attacker to Man in the Middle (MitM) the DNS lookup and inject a response that points to a different IP address. The attacker can then pretend to be the local app and send fake responses back to the web app, which may compromise your account on the web app side, depending on how it is designed.

    The successful MitM in this situation is possible because in order to make it work, you had to ship the private key to your certificate with your native app. That means that anybody who downloads your native app gets a copy of the private key, including the attacker. This is considered a compromise of your private key, and your Certificate Authority (CA) is required to revoke your certificate if they become aware of it. Many native apps have had their certificates revoked for shipping their private key.

    Unfortunately, this leaves native apps without a lot of good, secure options to communicate with their corresponding web site. And the situation may get trickier in the future if browsers further tighten access to localhost from the web.

    Also note that exporting a web service that offers privileged native APIs is inherently risky, because web sites that you didn’t intend to authorize may access them. If you go down this route, make sure to read up on Cross-Origin Resource Sharing, use Access-Control-Allow-Origin, and make sure to use a memory-safe HTTP parser, because even origins you don’t allow access to can send preflight requests, which may be able to exploit bugs in your parser.

    Making and trusting your own certificates

    Anyone can make their own certificates without help from a CA. The only difference is that certificates you make yourself won’t be trusted by anyone else. For local development, that’s fine.

    The simplest way to generate a private key and self-signed certificate for localhost is with this openssl command:

    openssl req -x509 -out localhost.crt -keyout localhost.key \
      -newkey rsa:2048 -nodes -sha256 \
      -subj '/CN=localhost' -extensions EXT -config <( \
       printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
    

    You can then configure your local web server with localhost.crt and localhost.key, and install localhost.crt in your list of locally trusted roots.

    If you want a little more realism in your development certificates, you can useminica to generate your own local root certificate, and issue end-entity (aka leaf) certificates signed by it. You would then import the root certificate rather than a self-signed end-entity certificate.

    You can also choose to use a domain with dots in it, like “www.localhost”, by adding it to /etc/hosts as an alias to 127.0.0.1. This subtly changes how browsers handle cookie storage.

    展开全文
  • 问题:ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: NO) 很久没用这台电脑的mysql了,今天需要连接数据库,启动数据库报错: ERROR 1045 (28000): Access denied for user ...
  • 经常会遇到网站打开很缓慢的时候,前一段时间就有网友向我咨询该错误引起的原因,并且他在网上找了诸多方案,都未能见效,在我解决了这个问题后,便打算在PHPCUSTOM的功能大全里面集成一键优化localhost的功能,让...
  • Win10-64bit 安装 MySQL5.7,解决 Access denied for user ‘root’@’localhost’ 问题问题: 本文主要介绍 在 windows10-64bit 操作系统中安装最新版的 MySQL5.7 基本流程 解决进入MySQL遇到的 Access ...
  • Linux修改localhost

    千次阅读 2020-07-20 15:11:11
    1. 首先修改/etc/hosts 第一行 127.0.0.1后面localhost localhost.localhostdomain 修改为自己需要的名字。 2. 在/etc/hostname中 hostname后加上自己需要修改的名字。 3. reboot后重新登陆即可。 ...
  • Mac localhost无法访问

    千次阅读 2019-11-14 09:34:39
    Mac localhost无法访问 localhost:8080和127.0.0.1:8080可以访问nginx的文件,但输入localhost和127.0.0.1都打不开了
  • 安装portal的时候就已经配置过https,而且之前的一段时间访问“https://localhost”的时候也是能正常访问,但是今天访问的时候发现突然不行了,浏览器报错“localhost拒绝了我们的请求”,所以很是郁闷。 解决...
  • 通俗易懂,告诉你localhost的秘密 很多做Javaweb的同学都知道,当你通过eclipse或者idea启动你的web项目后,程序会自动呼出一个浏览器,浏览器地址栏的网址就是 http://localhost:8080/你的项目名称,一开始学的时候...
  • 一般的web服务器有两部分日志: 一是运行中的日志catalina.out,它主要记录运行的一些信息,尤其是...localhost.Y-M-D.log 经常用到的文件之一 ,程序异常没有被捕获的时候抛出的地方 Tomcat下内部代码丢出的...
  • Windows下修改本机域名localhost

    千次阅读 2020-02-19 22:31:19
    127.0.0.1 localhost 我们只需要将 localhost 修改为自己想要的域名即可。如: 127.0.0.1 sun.com 注意: IP 和 域名之间要用 Tab 键隔开。 博客中若有不恰当的地方,请您一定要告诉我。前路崎岖,望我们...
  • 什么是localhost(127.0.0.1)?

    万次阅读 2019-06-03 00:20:41
    localhost 始终是你自己的计算机。当你呼叫本地主机时,你的计算机正在通话。你的计算机并不总是直接识别本地主机。在你的个人网络中,localhost有一个单独的IP地址,如192.168.0.1。(大多数情况下),与你在互联网...
  • MAC——本机域名[localhost]配置

    千次阅读 2020-02-18 13:48:20
    localhost:保留域名(RFC 2606) ,为了避免同狭义定义主机名混淆而单独列出。 在可用其他方式使用计算机主机名称的地方,可以指定主机为localhost。例如,将web服务器上安装的web浏览器指向http://localhost,将会...
  • localhost和127.0.0.1有什么区别?

    千次阅读 2020-05-23 19:43:05
    一、localhost和127.0.0.1的关系:  localhost也叫local ,正确的解释是:本地服务器。 localhost 是一个域名,在过去它指向127.0.0.1这个IP地址。在操作系统支持 ipv6 后,它同时还指向ipv6 的地址 [::1]  ...
  • 按照这个路径找到hosts文件,右键打开方式使用记事本打开,在localhost下面加上想要的任意域名。 因为不能直接保存,所以需要全选复制hosts文件的内容,新建一个txt文件,粘贴到里面,然后强制删除...
  • package.json写了“proxy”:"http://localhost:8080" 下面是App.js里component StaffList.js代码,cnpm start后console显示异常: Proxy error: Could not proxy request /api/staffs from localhost:3000 to ...
  • nacos 总是访问localhost

    千次阅读 2020-10-19 10:22:25
    spring cloud 集成nacos 总是按照nacos官方配置后,发现已经注册到nacos,但是同时还总是出现访问localhost的异常, 解决方法: resources下创建bootstrap.properties,增加配置:spring.cloud.nacos.config....
  • ping localhost

    千次阅读 2018-06-04 11:39:10
    在cmd中ping localhost解析出来的是IPV6的::1,原因是windows有个优先解析列表,当ipv6的优先级高于ipv4时,就会出现这种情况。网上有一种方法是修改注册表的,具体方法为:打开RegEdit,导航到HKEY_LOCAL_MACHINE \...
  • localhost 和 0.0.0.0 区别

    万次阅读 多人点赞 2018-11-14 13:23:49
    指定使用一个 host,默认是 localhost,如果你希望服务器外部可访问,制定如下: host: &quot;0.0.0.0&quot; 不过我这样设置后,同样能够在本地通过 localhost 访问到,不禁想要掰一掰两者的区别,在这里做...
  • CentOS - 修改主机名教程(将 localhost.localdomain 改成其它名字) 原文出自:www.hangge.com转载请保留原文链接:https://www.hangge.com/blog/cache/detail_2416.html CentOS - 修改主机名教程(将 ...
  • 在默认配置情况下,正常启动flink后访问localhost:8081,显示启动成功。 输入网址localhost:8081,显示如下情况。 原因分析: 主要是网络配置的原因,具体原因我也不懂,但是配置好了网络就解决了。 解决方案: ...
  • Client port found: 2181. Client address: localhost. 的解决办法

    万次阅读 热门讨论 2019-06-17 14:36:12
    问题概述 关于这个问题,是在zookeeper启动时遇到的,输入命令 “ ./zkServer.sh start ” 启动时未报错,链接时连接不上zookeeper服务,查看zookeeper状态输入... Client address: localhost.” 异常截图如下: ...
  • 我在安装Apache时出现的问题,安装都没有问题,但是到最后测试的时候我输入localhost显示没问题,是“it works”![图片说明](https://img-ask.csdn.net/upload/201901/22/1548167397_843680.png) 但是我输入...
  • localhost: root@localhost: Permission denied (publickey,password). 网上查了一下说是配置ssh免登录的问题解决了就行了。但我其实是配置好了本地免登录在进行的这一步,当我执行ssh localhost时可以免密码登录,...
  • localhost:8080

    万次阅读 2019-05-21 11:54:00
    本地发布(localhost:8080)的web项目如何让其他主机访问? 本地localhost:8080的java web项目,在没有部署到服务器的情况下,如何让另一台主机访问自己本地的项目呢?请看下面详解! 上学期做的一个java web ...
  • 手机怎么访问电脑的localhost页面

    千次阅读 2019-11-15 14:53:22
    手机怎么访问电脑的localhost页面 要想实现手机端也能访问电脑的localhost页面,首先就是电脑连接的是手机的热点 然后用快捷键window+R 运用doc命令,获输入 IPCONFIG 获取IPv4地址: 然后在手机端输入192.168.xx....
  • 本地访问localhost特别慢

    千次阅读 2020-04-10 14:42:24
    https://blog.csdn.net/LabDNirvana/article/details/88887741 解决 ... ping一下localhost, 2.输入命令 netsh interface ipv6 show prefixpolicies,查询ipv6优先级 ...
  • localhost无法访问

    千次阅读 2019-05-04 21:41:22
    在建立本地网站后,输入localhost后发现无法打开网站首页。百度一下,发现原来是没有打开IIS管理服务器。 按照网上所说,控制面板-管理工具打开后就可以找到IIS管理服务器了。但是我的打开是这样的,没有IIS管理...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 2,180,387
精华内容 872,154
关键字:

localhost