1. 程式人生 > >解決 Hadoop 中 從節點 不能遠端登入 主節點的MySQL資料庫.

解決 Hadoop 中 從節點 不能遠端登入 主節點的MySQL資料庫.

目錄:

  • Host 'shizhan04' is not allowed to connect to this MySQL server 問題,及解決方案
  • Access denied for user 'root'@'localhost' (using password: YES) 問題,及解決方案

1. 問題: "Host 'shizhan04' is not allowed to connect to this MySQL server"

 方案:

服務端 (主節點授權)mysql 授權

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'

 IDENTIFIED BY 'youpassword' WITH GRANT OPTION;

 

2.  問題:Access denied for user 'root'@'localhost' (using password: YES)

方案:

從節點搭建mysql 環境!!!

$ vi /etc/my.conf

在[mysqld]標籤下 新增

skip-grand-tables

進入mysql中,此時不需要密碼

>use mysql

>update user set password=password("new password") where username = 'root'

>quit

$/etc/init.d/mysqld restart

在[mysqld]標籤下 取消該內容

skip-grand-tables

$mysql -uroot -p

輸入new password

該問題解決~