c3p0无法与mysql数据库建立连接-访问被拒绝

c3p0无法与mysql数据库建立连接-访问被拒绝,mysql,c3p0,Mysql,C3p0,我无法从mysql数据库获得连接,尽管我可以使用用户名和密码连接到数据库 java.sql.SQLException: Access denied for user 'root '@'localhost' (using password: YES) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.

我无法从mysql数据库获得连接,尽管我可以使用用户名和密码连接到数据库

java.sql.SQLException: Access denied for user 'root '@'localhost' (using password: YES)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4074)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4006)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:919)
    at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1694)
    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1244)
    at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2397)
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2430)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2215)
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:813)
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)

表示用户“root”@“localhost”-您确定在root之后没有额外的空间吗?没有。我已检查了属性文件,它在root之后没有任何空间。不知道还有什么要告诉您的,可能您正在某个地方加载该属性,并将其添加到空间中?我们需要更多的信息来帮助你。你能提供你的配置属性文件吗?
Ashishs-MacBook-Pro:~ atyagi$ mysql --user=root --password=pass sample
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 643
Server version: 5.5.34 MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>