欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

一文解決連接MySQL報(bào)錯(cuò)is?not?allowed?to?connect?to?this?MySQL?server

 更新時(shí)間:2023年08月11日 09:46:14   作者:Gzzz__  
這篇文章主要給大家介紹了關(guān)于如何通過一文解決連接MySQL報(bào)錯(cuò)is?not?allowed?to?connect?to?this?MySQL?server的相關(guān)資料,文中通過圖文介紹的非常詳細(xì),需要的朋友可以參考下

問題描述:

本機(jī)裝的MySQL數(shù)據(jù)庫(kù),本機(jī)可以正常連接,其他機(jī)器訪問報(bào)錯(cuò),is not allowed to connect to this MySQL server,防火墻等其他策略均配置沒問題 。

解決方案:

出現(xiàn)該問題的原因是,MySQL數(shù)據(jù)庫(kù)只允許自身所在的本機(jī)器連接,不允許遠(yuǎn)程連接。

1、在MySQL所在服務(wù)器上使用命令登錄到MySQL數(shù)據(jù)庫(kù)中

mysql -u root -p

2、選擇mysql數(shù)據(jù)庫(kù),并查詢權(quán)限

use mysql; select host from user where user='root';

可以看到,執(zhí)行查詢語(yǔ)句后得到的數(shù)據(jù)結(jié)果中 host 的值是 localhost

我們執(zhí)行update語(yǔ)句修改權(quán)限

update user set host = '%' where user ='root';

3、刷新配置

flush privileges;

再次執(zhí)行查詢權(quán)限語(yǔ)句

select host from user where user='root';

可以看到,已經(jīng)修改成功

4、最后再次用其他機(jī)器連接MySQL數(shù)據(jù)庫(kù),可以連接成功

DBMS: MySQL (版本 5.7.41)
區(qū)分大小寫: 普通形式=lower, 分隔形式=lower
驅(qū)動(dòng)程序: MySQL Connector/J (版本 mysql-connector-java-8.0.25 (Revision: 08be9e9b4cba6aa115f9b27b215887af40b159e0),JDBC4.2)

Ping: 29毫秒
SSL: yes

<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->
<!--
 | This is the configuration file for Maven. It can be specified at two levels:
 |
 |  1. User Level. This settings.xml file provides configuration for a single user,
 |                 and is normally provided in ${user.home}/.m2/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -s /path/to/user/settings.xml
 |
 |  2. Global Level. This settings.xml file provides configuration for all Maven
 |                 users on a machine (assuming they're all using the same Maven
 |                 installation). It's normally provided in
 |                 ${maven.conf}/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -gs /path/to/global/settings.xml
 |
 | The sections in this sample file are intended to give you a running start at
 | getting the most out of your Maven installation. Where appropriate, the default
 | values (values used when the setting is not specified) are provided.
 |
 |-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">
  <!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
  -->
  <!-- interactiveMode
   | This will determine whether maven prompts you when it needs input. If set to false,
   | maven will use a sensible default value, perhaps based on some other setting, for
   | the parameter in question.
   |
   | Default: true
  <interactiveMode>true</interactiveMode>
  -->
  <!-- offline
   | Determines whether maven should attempt to connect to the network when executing a build.
   | This will have an effect on artifact downloads, artifact deployment, and others.
   |
   | Default: false
  <offline>false</offline>
  -->
  <!-- pluginGroups
   | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
   | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
   | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
   |-->
  <pluginGroups>
    <!-- pluginGroup
     | Specifies a further group identifier to use for plugin lookup.
    <pluginGroup>com.your.plugins</pluginGroup>
    -->
  </pluginGroups>
  <!-- proxies
   | This is a list of proxies which can be used on this machine to connect to the network.
   | Unless otherwise specified (by system property or command-line switch), the first proxy
   | specification in this list marked as active will be used.
   |-->
  <proxies>
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
     |
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxy.host.net</host>
      <port>80</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
    -->
  </proxies>
  <!-- servers
   | This is a list of authentication profiles, keyed by the server-id used within the system.
   | Authentication profiles can be used whenever maven must make a connection to a remote server.
   |-->
  <servers>
    <!-- server
     | Specifies the authentication information to use when connecting to a particular server, identified by
     | a unique name within the system (referred to by the 'id' attribute below).
     |
     | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
     |       used together.
     |
    <server>
      <id>deploymentRepo</id>
      <username>repouser</username>
      <password>repopwd</password>
    </server>
    -->
    <!-- Another sample, using keys to authenticate.
    <server>
      <id>siteServer</id>
      <privateKey>/path/to/private/key</privateKey>
      <passphrase>optional; leave empty if not used.</passphrase>
    </server>
    -->
  </servers>
  <!-- mirrors
   | This is a list of mirrors to be used in downloading artifacts from remote repositories.
   |
   | It works like this: a POM may declare a repository to use in resolving certain artifacts.
   | However, this repository may have problems with heavy traffic at times, so people have mirrored
   | it to several places.
   |
   | That repository definition will have a unique id, so we can create a mirror reference for that
   | repository, to be used as an alternate download site. The mirror site will be the preferred
   | server for that repository.
   |-->
  <mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    <mirror>
      <id>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
     -->
    <mirror>
      <id>maven-default-http-blocker</id>
      <mirrorOf>external:http:*</mirrorOf>
      <name>Pseudo repository to mirror external repositories initially using HTTP.</name>
      <url>http://0.0.0.0/</url>
      <blocked>true</blocked>
    </mirror>
  </mirrors>
  <!-- profiles
   | This is a list of profiles which can be activated in a variety of ways, and which can modify
   | the build process. Profiles provided in the settings.xml are intended to provide local machine-
   | specific paths and repository locations which allow the build to work in the local environment.
   |
   | For example, if you have an integration testing plugin - like cactus - that needs to know where
   | your Tomcat instance is installed, you can provide a variable here such that the variable is
   | dereferenced during the build process to configure the cactus plugin.
   |
   | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
   | section of this document (settings.xml) - will be discussed later. Another way essentially
   | relies on the detection of a system property, either matching a particular value for the property,
   | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
   | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
   | Finally, the list of active profiles can be specified directly from the command line.
   |
   | NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
   |       repositories, plugin repositories, and free-form properties to be used as configuration
   |       variables for plugins in the POM.
   |
   |-->
  <profiles>
    <!-- profile
     | Specifies a set of introductions to the build process, to be activated using one or more of the
     | mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
     | or the command line, profiles have to have an ID that is unique.
     |
     | An encouraged best practice for profile identification is to use a consistent naming convention
     | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
     | This will make it more intuitive to understand what the set of introduced profiles is attempting
     | to accomplish, particularly when you only have a list of profile id's for debug.
     |
     | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
    <profile>
      <id>jdk-1.4</id>
      <activation>
        <jdk>1.4</jdk>
      </activation>
      <repositories>
        <repository>
          <id>jdk14</id>
          <name>Repository for JDK 1.4 builds</name>
          <url>http://www.myhost.com/maven/jdk14</url>
          <layout>default</layout>
          <snapshotPolicy>always</snapshotPolicy>
        </repository>
      </repositories>
    </profile>
    -->
    <!--
     | Here is another profile, activated by the system property 'target-env' with a value of 'dev',
     | which provides a specific path to the Tomcat instance. To use this, your plugin configuration
     | might hypothetically look like:
     |
     | ...
     | <plugin>
     |   <groupId>org.myco.myplugins</groupId>
     |   <artifactId>myplugin</artifactId>
     |
     |   <configuration>
     |     <tomcatLocation>${tomcatPath}</tomcatLocation>
     |   </configuration>
     | </plugin>
     | ...
     |
     | NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
     |       anything, you could just leave off the <value/> inside the activation-property.
     |
    <profile>
      <id>env-dev</id>
      <activation>
        <property>
          <name>target-env</name>
          <value>dev</value>
        </property>
      </activation>
      <properties>
        <tomcatPath>/path/to/tomcat/instance</tomcatPath>
      </properties>
    </profile>
    -->
  </profiles>
  <!-- activeProfiles
   | List of profiles that are active for all builds.
   |
  <activeProfiles>
    <activeProfile>alwaysActiveProfile</activeProfile>
    <activeProfile>anotherAlwaysActiveProfile</activeProfile>
  </activeProfiles>
  -->
</settings>

1。 改表法??赡苁悄愕膸ぬ?hào)不允許從遠(yuǎn)程登陸,只能在localhost。這個(gè)時(shí)候只要在localhost的那臺(tái)電腦,登入mysql后,更改 "mysql" 數(shù)據(jù)庫(kù)里的 "user" 表里的 "host" 項(xiàng),從"localhost"改稱"%"

Sql代碼 復(fù)制代碼

   1. mysql -u root -pvmwaremysql>use mysql; 

   2. mysql>update user set host = '%' where user = 'root'; 

   3. mysql>select host, user from user; 

2. 授權(quán)法。例如,你想myuser使用mypassword從任何主機(jī)連接到mysql服務(wù)器的話。

Sql代碼 復(fù)制代碼

  1. GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH

      GRANT OPTION;  

  2.FLUSH   PRIVILEGES; 

總結(jié) 

到此這篇關(guān)于解決連接MySQL報(bào)錯(cuò)is not allowed to connect to this MySQL server的文章就介紹到這了,更多相關(guān)is not allowed to connect to this MySQL server內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • MySQL Shell import_table數(shù)據(jù)導(dǎo)入的實(shí)現(xiàn)

    MySQL Shell import_table數(shù)據(jù)導(dǎo)入的實(shí)現(xiàn)

    這篇文章主要介紹了MySQL Shell import_table數(shù)據(jù)導(dǎo)入的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-08-08
  • mysql5.6 主從復(fù)制同步詳細(xì)配置(圖文)

    mysql5.6 主從復(fù)制同步詳細(xì)配置(圖文)

    這篇文章主要介紹了mysql5.6 主從復(fù)制同步詳細(xì)配置,但不是很詳細(xì)推薦大家看下腳本之家以前的文章,需要的朋友可以參考下
    2016-04-04
  • 淺析MySQL的基數(shù)統(tǒng)計(jì)

    淺析MySQL的基數(shù)統(tǒng)計(jì)

    這篇文章主要介紹了MySQL的基數(shù)統(tǒng)計(jì)的相關(guān)資料,幫助大家更好的理解和學(xué)習(xí)MySQL數(shù)據(jù)庫(kù)的使用,感興趣的朋友可以了解下
    2020-11-11
  • MySQL中使用FREDATED引擎實(shí)現(xiàn)跨數(shù)據(jù)庫(kù)服務(wù)器、跨實(shí)例訪問

    MySQL中使用FREDATED引擎實(shí)現(xiàn)跨數(shù)據(jù)庫(kù)服務(wù)器、跨實(shí)例訪問

    這篇文章主要介紹了MySQL中使用FREDATED引擎實(shí)現(xiàn)跨數(shù)據(jù)庫(kù)服務(wù)器、跨實(shí)例訪問,本文講解了FEDERATED存儲(chǔ)引擎的描述、安裝與啟用FEDERATED存儲(chǔ)引擎、準(zhǔn)備遠(yuǎn)程服務(wù)器環(huán)境等內(nèi)容,需要的朋友可以參考下
    2014-10-10
  • MySql8.0以上版本正確修改ROOT密碼的方法

    MySql8.0以上版本正確修改ROOT密碼的方法

    這篇文章主要介紹了MySql8.0以上版本正確修改ROOT密碼的方法,文中給大家提到了成功部署完畢后出現(xiàn)故障情況,本文分步驟給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-06-06
  • MySQL 大表添加一列的實(shí)現(xiàn)

    MySQL 大表添加一列的實(shí)現(xiàn)

    這篇文章主要介紹了MySQL 大表添加一列的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-02-02
  • 如何備份MySQL數(shù)據(jù)庫(kù)

    如何備份MySQL數(shù)據(jù)庫(kù)

    網(wǎng)站數(shù)據(jù)對(duì)我們對(duì)站長(zhǎng)來說都是最寶貴的,我們平時(shí)應(yīng)該養(yǎng)成良好的備份數(shù)據(jù)的習(xí)慣。這樣可使我們數(shù)據(jù)庫(kù)崩潰造成的損失大大降低
    2015-01-01
  • 重裝mysql時(shí)3306端口被占用的解決方法

    重裝mysql時(shí)3306端口被占用的解決方法

    如果在安裝mysql中出現(xiàn)3306端口不能使用,已經(jīng)被占用的過程,則需要將該端口號(hào)的進(jìn)程釋放即可,所以本文給大家介紹了重裝mysql時(shí)3306端口被占用的解決方法,需要的朋友可以參考下
    2024-02-02
  • MySQL存儲(chǔ)引擎InnoDB架構(gòu)原理和執(zhí)行流程

    MySQL存儲(chǔ)引擎InnoDB架構(gòu)原理和執(zhí)行流程

    InnoDB是MySQL的當(dāng)前默認(rèn)存儲(chǔ)引擎,支持外鍵、行級(jí)鎖定和ACID事務(wù),通過BufferPool緩沖池緩存數(shù)據(jù),RedoLogBuffer和undo日志文件保證數(shù)據(jù)的持久性和回滾能力,MySQL宕機(jī)重啟時(shí),InnoDB會(huì)根據(jù)LSN值決定是否需要從redo日志恢復(fù)數(shù)據(jù)
    2025-04-04
  • Navicat使用報(bào)2059錯(cuò)誤的兩種解決方案

    Navicat使用報(bào)2059錯(cuò)誤的兩種解決方案

    Navicat是一款流行的數(shù)據(jù)庫(kù)管理工具,而MySQL則是其中的一種數(shù)據(jù)庫(kù)軟件,下面這篇文章主要給大家介紹了關(guān)于Navicat使用報(bào)2059錯(cuò)誤的兩種解決方案,需要的朋友可以參考下
    2023-11-11

最新評(píng)論