“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';

相关连结

外部链接