title: Cannot create PoolableConnectionFactory Client does not support authentication
body: <p>I'm trying to connect with MySQL on the DataSource facilities.I have a database created, sql script, class where I get the connection, context.xml configuration file.</p>
  
  <blockquote>
    <p>java.sql.SQLException: Cannot create PoolableConnectionFactory (Client
    does not support authentication protocol requested by server; consider
    upgrading MySQL client)</p>
  </blockquote>
  
  <pre><code>CONNECT 'jdbc:mysql://localhost:3306/testDB?user=root&amp;password=root';
      CREATE TABLE roles(
  
          id INTEGER NOT NULL PRIMARY KEY,
          name VARCHAR(10) NOT NULL UNIQUE
      );
      INSERT INTO roles VALUES(0, 'admin');
      INSERT INTO roles VALUES(1, 'client');
  
      CREATE TABLE users(
          id INTEGER NOT NULL generated always AS identity PRIMARY KEY,
          login VARCHAR(10) NOT NULL UNIQUE,
          password VARCHAR(10) NOT NULL,
          first_name VARCHAR(20) NOT NULL,
          last_name VARCHAR(20) NOT NULL,
  
              ON DELETE CASCADE
              ON UPDATE RESTRICT
      );
  
      INSERT INTO users VALUES(DEFAULT, 'admin', 'admin', 'Harry', 'Potter', 0);
      INSERT INTO users VALUES(DEFAULT, 'client', 'client', 'Peter', 'Parker', 1);
  </code></pre>
  
  <p>сontext.xml</p>
  
  <pre><code>&lt;Context&gt;
      &lt;Resource name="jdbc/testDB_MySQL"
                auth="Container"
                type="javax.sql.DataSource"
                maxActive="100" maxIdle="30" maxWait="10000"
                username="root" password="root"
                driverClassName="com.mysql.jdbc.Driver"
                defaultAutoCommit="false"
                defaultTransactionIsolation="READ_COMMITTED"
                url="jdbc:mysql://localhost:3306/testDB"/&gt;
  &lt;/Context&gt;
  </code></pre>
  
  <p>And DBManager class, where I get the connection and the data from the tables</p>
  
  <pre><code>private static DBManager instance;
  
      public static synchronized DBManager getInstance() throws DBException {
          if (instance == null) {
              instance = new DBManager();
          }
          return instance;
      }
  
      private DBManager() throws DBException {
          try {
              Context initContext = new InitialContext();
              Context envContext = (Context) initContext.lookup("java:/comp/env");
              // ST4DB - the name of data source
              ds = (DataSource) envContext.lookup("jdbc/testDB_MySQL");
              LOG.trace("Data source ==&gt; " + ds);
          } catch (NamingException ex) {
              ex.printStackTrace();
              LOG.error(Messages.ERR_CANNOT_OBTAIN_DATA_SOURCE, ex);
              throw new DBException(Messages.ERR_CANNOT_OBTAIN_DATA_SOURCE, ex);
          }
      }
  
      private DataSource ds;
  public Connection getConnection() throws DBException {
          Connection con = null;
          try {
              con = ds.getConnection();
          } catch (SQLException ex) {
              ex.printStackTrace();
              LOG.error(Messages.ERR_CANNOT_OBTAIN_CONNECTION, ex);
              throw new DBException(Messages.ERR_CANNOT_OBTAIN_CONNECTION, ex);
          }
          return con;
      }
  
  public User findUserByLogin(String login) throws DBException {
          User user = null;
          PreparedStatement pstmt = null;
          ResultSet rs = null;
          Connection con = null;
          try {
              con = getConnection();
              pstmt = con.prepareStatement(SQL_FIND_USER_BY_LOGIN);
              pstmt.setString(1, login);
              rs = pstmt.executeQuery();
              if (rs.next()) {
                  user = extractUser(rs);
              }
              con.commit();
          } catch (SQLException ex) {
              rollback(con);
              ex.printStackTrace();
              throw new DBException(Messages.ERR_CANNOT_OBTAIN_USER_BY_LOGIN, ex);
          } finally {
              close(con, pstmt, rs);
          }
          return user;
      }
  </code></pre>
  
  <p>And DataSources and Driver<a href="https://i.stack.imgur.com/tYjtL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tYjtL.png" alt="enter image description here"></a>
  What could be the problem? I will be grateful for the answers!</p>