java.sql.SQLException: Access denied for user ‘root’@’localhost’ (using password: YES)


MySQL doesn't support some types of characters (such as emojis) with the utf8 encoding. You need to be on MySQL 5.5+ and force utf8mb4 (everywhere, client and server). You can do this sending the query "SET NAMES utf8mb4". Check this

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • Connect to MySQL with JDBC driver
    via by Unknown author,
  • Error using latest for geSuite
    via GitHub by Kainzo
  • Mysql Tomcat java.sql.SQLException - Spring Forum
    via by Unknown author,
  • accesssing another systems databse?
    via Stack Overflow by user1741023
    • java.sql.SQLException: Access denied for user ‘root’@’localhost’ (using password: YES) at com.mysql.jdbc.SQLError.createSQLException( at com.mysql.jdbc.MysqlIO.checkErrorPacket( at com.mysql.jdbc.MysqlIO.checkErrorPacket( at com.mysql.jdbc.MysqlIO.checkErrorPacket( at com.mysql.jdbc.MysqlIO.secureAuth411( at com.mysql.jdbc.MysqlIO.doHandshake( at com.mysql.jdbc.ConnectionImpl.coreConnect( at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly( at com.mysql.jdbc.ConnectionImpl.createNewIO( at com.mysql.jdbc.ConnectionImpl.<init>( at com.mysql.jdbc.JDBC4Connection.<init>( at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance( at sun.reflect.DelegatingConstructorAccessorImpl.newInstance( at java.lang.reflect.Constructor.newInstance( at com.mysql.jdbc.Util.handleNewInstance( at com.mysql.jdbc.ConnectionImpl.getInstance( at com.mysql.jdbc.NonRegisteringDriver.connect( at java.sql.DriverManager.getConnection( at java.sql.DriverManager.getConnection( at JDBCTest.main(

    Users with the same issue

    linxiaolong1 times, last one,
    Victor_IT1 times, last one,
    jshakil3 times, last one,
    jstrayer6 times, last one,
    Unknown visitor1 times, last one,
    146 more bugmates