2,187
edits
m (→Keys / Indexes: Minor update) |
(→Create Users: Renamed to "Create Users and Grant/Revoke Privileges" and added Revoke example) |
||
Line 21: | Line 21: | ||
== User Accounts == | == User Accounts == | ||
=== Create Users === | === Create Users and Grant/Revoke Privileges === | ||
To give full privileges (including the ability to alter user accounts) to a user coming from any location use; | To give full privileges (including the ability to alter user accounts) to a new user coming from any location use; | ||
<source lang="mysql"> GRANT ALL PRIVILEGES on <database>.* to '<user>'@'%' identified by '<password>' with grant option; </source> | <source lang="mysql"> GRANT ALL PRIVILEGES on <database>.* to '<user>'@'%' identified by '<password>' with grant option; </source> | ||
To give no privileges to a user coming from a specific host; | To give no privileges to a new user coming from a specific host; | ||
<source lang="mysql"> GRANT USAGE on <database>.* to '<user>'@'<host>' identified by '<password>'; </source> | <source lang="mysql"> GRANT USAGE on <database>.* to '<user>'@'<host>' identified by '<password>'; </source> | ||
To give | To give an existing user read-only access; | ||
<source lang="mysql"> GRANT SELECT on <database>.* to '<user>'@'<host | <source lang="mysql"> GRANT SELECT on <database>.* to '<user>'@'<host>';</source> | ||
To give user ''web-user'', read-only access to local database ''webdb''; | To give an existing user ''web-user'', read-only access to local database ''webdb''; | ||
<source lang="mysql"> GRANT SELECT ON webdb.* TO 'web-user'@'localhost' | <source lang="mysql"> GRANT SELECT ON webdb.* TO 'web-user'@'localhost';</source> | ||
To remove/revoke a privilege from an existing user ''web-user''; | |||
<source lang="mysql"> REVOKE SELECT ON webdb.* FROM 'web-user'@'localhost';</source> | |||
=== Delete Users === | === Delete Users === |