title: Mysql Access denied for user 'user'@'localhost' (using password: yes) "openshift"
body: <p>i want to connect to <code>mysql</code> database hosted in <code>openshift</code> server using java.
  everything works fine on my local computer but when i try connect to <code>openshift</code> database i am getting this <code>error</code> </p>
  
  <blockquote>
    <p>java.sql.SQLException: Access denied for user :        'userEl'@'@localhost' (using password: yes)
                at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957)
                at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3878)
                at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3814)
                at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:871)
                at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1694)
                at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1215)
                at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2255)
                at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2286)
                at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2085)
                at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:795)
                at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:44)
                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
                at java.lang.reflect.Constructor.newInstance(Unknown Source)
                at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
                at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:400)
                at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:327)
                at java.sql.DriverManager.getConnection(Unknown Source)
                at java.sql.DriverManager.getConnection(Unknown Source)
                at myjava.Test.main(Test.java:13)</p>
  </blockquote>
  
  <p>here is my code </p>
  
  <pre><code>    public class Test {
  
          public static void main(String[] args) {
              String state;
              try {
                  Connection con = DriverManager.getConnection("jdbc:mysql://ip/mydb","userEl","password");
                  Statement stm= con.createStatement();
                  ResultSet rs= stm.executeQuery("SELECT * FROM server");
  
                    while(rs.next()){
                        state=rs.getString(1);
                        System.out.println("state = "+ state);
                    }
                          } catch (SQLException e) {
                          e.printStackTrace();
                                  }
                  }
  </code></pre>