1. 程式人生 > 實用技巧 >CDH 初始化資料庫 報錯ERROR Exception when creating/dropping database with user 'root' and jdbc url 'jdbc:mys

CDH 初始化資料庫 報錯ERROR Exception when creating/dropping database with user 'root' and jdbc url 'jdbc:mys

初始化報該錯CDH 初始化資料庫 報錯ERROR Exception when creating/dropping database with user ‘root’ and jdbc url ‘jdbc:mysql://localhost/?useUnicode=true&characterEncoding=UTF-8’,原因是沒有該使用者,無法建立。

初始化命令格式:
在這裡插入圖片描述

解決方法:進到mysql資料庫裡新增建立使用者,格式如下
grant all privileges on . to ‘root’@‘localhost’ identified by ‘123456’ with grant option;

grant all privileges on . to ‘root’@‘hadoop1’ identified by ‘123456’ with grant option;

grant all privileges on . to ‘root’@‘127.0.0.1’ identified by ‘123456’ with grant option;

grant all privileges on . to ‘root’@’%’ identified by ‘123456’ with grant option;

grant all privileges on . to ‘scm’@‘localhost’ identified by ‘scm’ with grant option;

grant all privileges on . to ‘scm’@‘hadoop1’ identified by ‘scm’ with grant option;

grant all privileges on . to ‘scm’@‘127.0.0.1’ identified by ‘scm’ with grant option;

grant all privileges on . to ‘scm’@’%’ identified by ‘scm’ with grant option;

PS。如果資料庫裡有cm和scm表,需要先刪除在重新初始化。