Creating mysql users
8:41 PMWork in Progress
The SQL statement for creating users is of the following form:GRANT (rights) ON (database).(table) TO (user)@(host) IDENTIFIED BY (password);
- rights = one or more of SELECT, INSERT, UPDATE, DELETE (see *note below)
- database = the database name
- table = the tables th euser is allowed to use or * for all tables
- user = the username the user will connect with
- host = the hostname the user will be allowed to connect from, or % for all hosts
- password = the password the user must supply to connect
GRANT SELECT,INSERT,UPDATE,DELETE ON projectX.* TO 'joeuser' @ '%' IDENTIFIED BY 'supersecretpassword' ; |
GRANT SELECT ON accounting.users TO 'receptionist' @ 'frontdesk.company.com' IDENTIFIED BY 'goodmorning' ; |
*Note about rights:
MySQL has a number of rights that can be granted to users. Chief among them are
- SELECT (query data)
- INSERT (add data)
- UPDATE (change data)
- DELETE (remove data)
- CREATE (create tables)
- ALTER (change tables)
- DROP (remove tables)
- INDEX (create or remove indexes)
0 comments