最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

一文解決連接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ù)庫,本機(jī)可以正常連接,其他機(jī)器訪問報(bào)錯(cuò),is not allowed to connect to this MySQL server,防火墻等其他策略均配置沒問題 。

解決方案:

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

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

mysql -u root -p

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

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

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

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

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

3、刷新配置

flush privileges;

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

select host from user where user='root';

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

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

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ù)庫里的 "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報(bào)錯(cuò)1292:Incorrect datetime value for column creat解決方案

    Mysql報(bào)錯(cuò)1292:Incorrect datetime value for 

    本文主要介紹了Mysql報(bào)錯(cuò)1292:Incorrect datetime value for column create_time at row 1 解決方案,1292 是指插入或更新操作時(shí),日期或時(shí)間值不正確引起的錯(cuò)誤,下面就來介紹一下
    2024-02-02
  • mysql數(shù)據(jù)庫如何導(dǎo)入導(dǎo)出sql文件

    mysql數(shù)據(jù)庫如何導(dǎo)入導(dǎo)出sql文件

    這篇文章主要介紹了mysql數(shù)據(jù)庫如何導(dǎo)入導(dǎo)出sql文件問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-11-11
  • MySQL多表查詢示例詳解

    MySQL多表查詢示例詳解

    本文系統(tǒng)講解了MySQL多表查詢的核心概念與分類,涵蓋內(nèi)連接、外連接(左/右)、自連接、聯(lián)合查詢及子查詢(標(biāo)量/列/行/表)等類型,重點(diǎn)介紹了各查詢方式的語法、應(yīng)用場景及注意事項(xiàng),適用于關(guān)系型數(shù)據(jù)庫中數(shù)據(jù)關(guān)聯(lián)與整合的開發(fā)實(shí)踐,感興趣的朋友跟隨小編一起看看吧
    2025-09-09
  • MySQL事務(wù)(transaction)看這篇就足夠了

    MySQL事務(wù)(transaction)看這篇就足夠了

    M事務(wù)的實(shí)現(xiàn)是基于數(shù)據(jù)庫的存儲(chǔ)引擎,不同的存儲(chǔ)引擎對(duì)事務(wù)的支持程度不一樣,下面這篇文章主要給大家介紹了關(guān)于MySQL事務(wù)(transaction)的相關(guān)資料,需要的朋友可以參考下
    2022-11-11
  • django2.2版本連接mysql數(shù)據(jù)庫的方法

    django2.2版本連接mysql數(shù)據(jù)庫的方法

    這篇文章主要介紹了django2.2版本如何連接mysql數(shù)據(jù)庫,本文圖文并茂給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-10-10
  • mysql between實(shí)現(xiàn)選取介于兩個(gè)值之間的數(shù)據(jù)范圍

    mysql between實(shí)現(xiàn)選取介于兩個(gè)值之間的數(shù)據(jù)范圍

    這篇文章主要介紹了mysql between實(shí)現(xiàn)選取介于兩個(gè)值之間的數(shù)據(jù)范圍,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-07-07
  • MySql Error 1698(28000)問題的解決方法

    MySql Error 1698(28000)問題的解決方法

    這篇文章主要介紹了MySql Error 1698(28000)問題的解決方法,需要的朋友可以參考下
    2017-06-06
  • Mysql 忘記root密碼的完美解決方法

    Mysql 忘記root密碼的完美解決方法

    通常在使用Mysql數(shù)據(jù)庫時(shí),如果長時(shí)間沒有登陸,或者由于工作交接完成度不高,會(huì)導(dǎo)致數(shù)據(jù)庫root登陸密碼忘記,本文給大家介紹一種當(dāng)忘記mysql root密碼時(shí)的解決辦法,一起看看吧
    2016-12-12
  • mysql中格式化日期詳解

    mysql中格式化日期詳解

    最近因?yàn)楣ぷ餍枰?,要使用mysql查詢記錄可如果有時(shí)間戳字段時(shí),查看結(jié)果不方便,不能即時(shí)看到時(shí)間戳代表的含義,所以這篇文章就提供mysql格式換時(shí)間函數(shù),可以方便的看到格式化后的時(shí)間。有需要的朋友們可以參考借鑒,下面來一起看看吧。
    2016-11-11
  • 淺談MySQL中的子查詢優(yōu)化技巧

    淺談MySQL中的子查詢優(yōu)化技巧

    這篇文章主要介紹了淺談MySQL中的子查詢優(yōu)化技巧,子查詢的優(yōu)化是MySQL諸多優(yōu)化方法中的基本,需要的朋友可以參考下
    2015-05-05

最新評(píng)論

尉犁县| 奎屯市| 宜春市| 开阳县| 永春县| 凤庆县| 贵南县| 吴江市| 监利县| 宁明县| 平果县| 福海县| 山丹县| 兴海县| 晋城| 绥滨县| 荆州市| 湘阴县| 辉县市| 舒城县| 庆安县| 常熟市| 司法| 来安县| 广平县| 泾阳县| 大足县| 连云港市| 淮安市| 景宁| 海南省| 无为县| 黄陵县| 嵩明县| 漳平市| 治多县| 金湖县| 黔江区| 红桥区| 华安县| 岗巴县|