Uploaded image for project: 'ManifoldCF'
  1. ManifoldCF
  2. CONNECTORS-476

When running on MySQL initialize.sh causes access denied error

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • ManifoldCF 0.5, ManifoldCF 0.6
    • ManifoldCF 0.6
    • Framework core
    • None

    Description

      initialize.sh causes access denied error if DB server is seperated from MCF's.

      Suppose each server's IP are like followings:

      MySQL Server IP: A
      MCF Server IP: B

      and properties.xml has the follwing parameters and values:

       <property name="org.apache.manifoldcf.databaseimplementationclass" value="org.apache.manifoldcf.core.database.DBInterfaceMySQL"/>
       <property name="org.apache.manifoldcf.dbsuperusername" value="root"/>
       <property name="org.apache.manifoldcf.dbsuperuserpassword" value="<password>"/>
       <property name="org.apache.manifoldcf.database.name" value="manifoldcf"/>
       <property name="org.apache.manifoldcf.mysql.server" value="A"/>
      

      Then, executing initialize.sh causes the follwing error:

      Caused by: java.sql.SQLException: Access denied for user 'manifoldcf'@'B' (using password: YES)
              at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
              at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609)
              at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541)
              at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:943)
              at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4113)
              at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1308)
              at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2336)
              at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2369)
              at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2153)
              at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:792)
              at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      

      The problem is that MCF requests MySQL to create a new "manifoldcf" user with localhost access.
      In this case, of course, MCF is on the server with IP B, MySQL should create a new user with IP Address B.

      The following method is the one creating a new MySQL user in the user table.
      Modifying the part where IP information is added solves this problem.

      JAR NAME :mcf-core.jar
      PACKAGE :org.apache.manifoldcf.core.database
      CLASS NAME :DBInterfaceMySQL
      METHOD NAME: public void createUserAndDatabase

                  if(userName != null)
                      try
                      {
                          list.clear();
                          list.add(userName);
                   //     list.add("localhost");
                          list.add(IP_ADDRESS_B);
                          list.add(password);
      		     ...
      		     ...
      		}
      

      I guess it would be nice if properties.xml can have a new property taking MCF server IP to
      have MySQL create a "manifoldcf" user with that IP.

      Attachments

        Activity

          People

            kwright@metacarta.com Karl Wright
            shige Shigeki Kobayashi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: