开发者

Communication failure during handshake. Is there a MySQL server running on localhost:3306

i am using below code

try {
            Class.forName("org.gjt.mm.mysql.Driver");
            conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/testdb","root","root"); // cust is the DSN Name
        } catch (Exception e) {
            System.out.println("Exception "+e);
        }

got this exception during run time...开发者_开发技巧

tried netstat -a in command prompt to check if mysql is running on port 3306 below is the trace...

Proto Local Address Foreign Address State TCP user:epmap user:0 LISTENING TCP user:microsoft-ds user:0 LISTENING TCP user:3306 user:0 LISTENING


Well, googling your problem i have come to this solution:

Try reseting your user password executing the next statement at your mysql command line client:

SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('root');

As it seems it kind of changes the authentication method at the mysql server.

Let me know if this have worked.

Other option is to check the compatibility between the version of your MySQL database and the MySQL JDBC driver you are using.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜