自動目錄
一、建立資料庫hw,也建立使用者給予該資料庫全部的存取權
CREATE USER 'hw'@'localhost';
GRANT USAGE ON * . * TO 'hw'@'localhost' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
CREATE DATABASE IF NOT EXISTS `hw` ;
GRANT ALL PRIVILEGES ON `hw` . * TO 'hw'@'localhost';
二、刪除使用者hw,也刪除同名資料庫
# 刪除 'hw'@'localhost' ...
DROP USER 'hw'@'localhost';
DROP DATABASE IF EXISTS `hw` ;
三、修改hw密碼為123456
SET PASSWORD FOR 'hw'@'localhost' = PASSWORD( '123456' );
四、建立資料庫 預設編碼 utf8
CREATE DATABASE `t5` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
五、建立全域權限使用者
CREATE USER 'hw'@'%' IDENTIFIED BY '****';
GRANT ALL PRIVILEGES ON * . * TO 'hw'@'%' IDENTIFIED BY '****' WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
原文 2012-03-19 14:35:32