<i id='z7mbN'><tr id='z7mbN'><dt id='z7mbN'><q id='z7mbN'><span id='z7mbN'><b id='z7mbN'><form id='z7mbN'><ins id='z7mbN'></ins><ul id='z7mbN'></ul><sub id='z7mbN'></sub></form><legend id='z7mbN'></legend><bdo id='z7mbN'><pre id='z7mbN'><center id='z7mbN'></center></pre></bdo></b><th id='z7mbN'></th></span></q></dt></tr></i><div id='z7mbN'><tfoot id='z7mbN'></tfoot><dl id='z7mbN'><fieldset id='z7mbN'></fieldset></dl></div>

      <tfoot id='z7mbN'></tfoot>
        <bdo id='z7mbN'></bdo><ul id='z7mbN'></ul>
    1. <small id='z7mbN'></small><noframes id='z7mbN'>

      1. <legend id='z7mbN'><style id='z7mbN'><dir id='z7mbN'><q id='z7mbN'></q></dir></style></legend>
      2. 无法访问 Sonar MySQL 数据库 原因:java.sql.SQLExcepti

        时间:2023-08-21

          • <bdo id='tMKqR'></bdo><ul id='tMKqR'></ul>
          • <i id='tMKqR'><tr id='tMKqR'><dt id='tMKqR'><q id='tMKqR'><span id='tMKqR'><b id='tMKqR'><form id='tMKqR'><ins id='tMKqR'></ins><ul id='tMKqR'></ul><sub id='tMKqR'></sub></form><legend id='tMKqR'></legend><bdo id='tMKqR'><pre id='tMKqR'><center id='tMKqR'></center></pre></bdo></b><th id='tMKqR'></th></span></q></dt></tr></i><div id='tMKqR'><tfoot id='tMKqR'></tfoot><dl id='tMKqR'><fieldset id='tMKqR'></fieldset></dl></div>
            <legend id='tMKqR'><style id='tMKqR'><dir id='tMKqR'><q id='tMKqR'></q></dir></style></legend>

              <small id='tMKqR'></small><noframes id='tMKqR'>

                <tbody id='tMKqR'></tbody>

              • <tfoot id='tMKqR'></tfoot>
                  本文介绍了无法访问 Sonar MySQL 数据库 原因:java.sql.SQLException:用户 'sonar'@'glassfishdev.ccs.local' 拒绝访问(使用密码:YES)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试将声纳添加到我的持续集成构建系统中.我使用 ANT 作为我的构建脚本,我使用 sonar-ant-task-1.1.jar 作为声纳根据我在 SVN 中的源代码生成报告.

                  I am trying to add Sonar to my Continuous Integration build system. I am using ANT as my build script and I am using the sonar-ant-task-1.1.jar for sonar to generate the reports based on my source code in SVN.

                  问题当构建运行并执行声纳蚂蚁任务时,我得到如下异常:

                  Problem When the build runs and hits the sonar ant task I get the exception as follows:

                  Caused by: java.sql.SQLException: Access denied for user 'sonar'@'glassfishdev.ccs.local' (using password: YES)
                  at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075)
                  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3566)
                  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3498)
                  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:919)
                  at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4004)
                  at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1284)
                  at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2312)
                  at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2122)
                  at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:774)
                  at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:49)
                  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
                  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
                  at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
                  at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
                  at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:375)
                  at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:289)
                  at org.sonar.jpa.session.DriverProxy.connect(DriverDatabaseConnector.java:160)
                  at java.sql.DriverManager.getConnection(DriverManager.java:582)
                  at java.sql.DriverManager.getConnection(DriverManager.java:185)
                  at org.sonar.jpa.session.DriverDatabaseConnector.getConnection(DriverDatabaseConnector.java:95)
                  at org.sonar.jpa.session.AbstractDatabaseConnector.testConnection(AbstractDatabaseConnector.java:185)
                  ... 40 more
                  

                  我做了什么

                  1.安装 MySQL 数据库.

                  1. Install MySQL database.

                  2. 使用声纳安装中提供的脚本创建声纳数据库、声纳用户并授予权限

                  2. Create the sonar database, sonar user, and grant permissions by using the script provided in the sonar installation

                  **CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;    
                  CREATE USER 'sonar' IDENTIFIED BY 'sonar';
                  GRANT ALL ON sonar.* TO 'sonar'@'%' IDENTIFIED BY 'sonar';
                  GRANT ALL ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar';
                  FLUSH PRIVILEGES;**
                  

                  3. 添加了 跟随到我的构建脚本

                  3. Added the following to my build script

                  4. 在 Jenkins Freestyle 构建项目中添加了以下外部变量

                  4. Added the following external variables in Jenkins Freestyle build project

                  sonar.jdbc.url=jdbc:mysql://10.120.21.12:3306/sonar?useUnicode=true&characterEncoding=utf8
                      sonar.jdbc.driverClassName=com.mysql.jdbc.Driver
                      sonar.jdbc.username=sonar
                      sonar.jdbc.password=sonar
                      sonar.host.url=http://10.120.21.12:9000/
                  

                  5.我还可以通过我的 sql 客户端工具连接到数据库,以验证数据库、用户和权限语句是否正确执行.

                  5. I was also available to connect to the database through my sql client tool to verify that the database, user and permissions statements were executed correctly.

                  然而,当 Jenkins 运行构建时,它似乎不知道如何连接到 MySQL 数据库.

                  However when Jenkins runs the build it does not seem to know how to connect to the MySQL database.

                  有什么想法吗?

                  推荐答案

                  解决方案是运行以​​下命令:

                  The solution was to run the following command:

                  全部授予 *.* 给 'sonar'@'%';

                  这篇关于无法访问 Sonar MySQL 数据库 原因:java.sql.SQLException:用户 'sonar'@'glassfishdev.ccs.local' 拒绝访问(使用密码:YES)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何使用 tnsname 从 Ant 连接到 Oracle 数据库? 下一篇:使用 ANT SQL 任务调用时 sql 脚本执行失败

                  相关文章

                  最新文章

                • <legend id='YEg3W'><style id='YEg3W'><dir id='YEg3W'><q id='YEg3W'></q></dir></style></legend>

                  <small id='YEg3W'></small><noframes id='YEg3W'>

                  1. <i id='YEg3W'><tr id='YEg3W'><dt id='YEg3W'><q id='YEg3W'><span id='YEg3W'><b id='YEg3W'><form id='YEg3W'><ins id='YEg3W'></ins><ul id='YEg3W'></ul><sub id='YEg3W'></sub></form><legend id='YEg3W'></legend><bdo id='YEg3W'><pre id='YEg3W'><center id='YEg3W'></center></pre></bdo></b><th id='YEg3W'></th></span></q></dt></tr></i><div id='YEg3W'><tfoot id='YEg3W'></tfoot><dl id='YEg3W'><fieldset id='YEg3W'></fieldset></dl></div>

                      <tfoot id='YEg3W'></tfoot>
                      • <bdo id='YEg3W'></bdo><ul id='YEg3W'></ul>