java.sql.SQLException: Access denied for user 'XXX'@'localhost' (using password: YES)

可能由于root的权限不够,可以进行如下操作

1)      以root进入mysql

2)      赋予root权限:

(在mysql   Command Line Client中输入以下命令)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost'

->     IDENTIFIED BY 'some_pass' WITH GRANT OPTION; 

//本地操作的权限

mysql> GRANTALL PRIVILEGES ON *.* TO ' root '@'%'

->     IDENTIFIEDBY 'some_pass' WITH GRANT OPTION;

                    //远程操作的权限




例如:

create database OTHERWebPlatform;

grant all on OTHERWebPlatform.* to lucy@localhost identified by '142857';

//设置字符类型
ALTER DATABASE `OTHERWebPlatform` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

你可能感兴趣的:(mysql数据库)