解決辦法, 經過 insert 命令的方式進行建立。php
建立數據庫用戶:mysql
$sql= "insert into mysql.user(Host,User,Password) VALUES ('localhost', '" . $username . "', password('" . $userpassword . "'))";
受權:sql
$sql = "INSERT INTO mysql.db VALUES('localhost','" . $dbName . "','" . $username . "','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');";
root用戶登陸後,分別執行以上sql便可。數據庫