「MySQL」修訂間的差異

從 Gea-Suan Lin's Wiki
跳至導覽 跳至搜尋
常用指令
常用指令
 
(未顯示同一使用者於中間所作的 3 次修訂)
行 4: 行 4:
 
 開帳號順便開權限:
 
 開帳號順便開權限:
 
<syntaxhighlight lang="sql">
 
<syntaxhighlight lang="sql">
GRANT ALL ON trac.* TO `trac`@`127.0.0.1` IDENTIFIED BY 'password_here';
 
 
GRANT ALL ON trac.* TO `trac`@`localhost` IDENTIFIED BY 'password_here';
 
GRANT ALL ON trac.* TO `trac`@`localhost` IDENTIFIED BY 'password_here';
 +
GRANT ALL ON trac.* TO `trac`@`%` IDENTIFIED BY 'password_here';
 
</syntaxhighlight>
 
</syntaxhighlight>
  
行 15: 行 15:
 
 只移除權限(單一資料庫或是全部):
 
 只移除權限(單一資料庫或是全部):
 
<syntaxhighlight lang="sql">
 
<syntaxhighlight lang="sql">
REVOKE ALL ON trac.* FROM 'trac'@'localhost';
+
REVOKE ALL, GRANT OPTION ON trac.* FROM 'trac'@'localhost';
REVOKE ALL FROM 'trac'@'localhost';
+
REVOKE ALL, GRANT OPTION FROM 'trac'@'localhost';
 +
</syntaxhighlight>
 +
 
 +
改密碼:
 +
<syntaxhighlight lang="sql">
 +
SET PASSWORD = 'newPassword';
 
</syntaxhighlight>
 
</syntaxhighlight>
  

於 2018年12月26日 (三) 08:19 的最新修訂

MySQL是一套資料庫軟件。

常用指令

開帳號順便開權限:

GRANT ALL ON trac.* TO `trac`@`localhost` IDENTIFIED BY 'password_here';
GRANT ALL ON trac.* TO `trac`@`%` IDENTIFIED BY 'password_here';

刪除(同時也會移除權限):

DROP USER 'trac'@'localhost';

只移除權限(單一資料庫或是全部):

REVOKE ALL, GRANT OPTION ON trac.* FROM 'trac'@'localhost';
REVOKE ALL, GRANT OPTION FROM 'trac'@'localhost';

改密碼:

SET PASSWORD = 'newPassword';

相關連結

外部連結