createuser [ options ] [ username ]
Use this parameter to provide the hostname that postmaster is running on.
Use this parameter to specify the TCP/IP port or socket file that postmaster is currently listening on.
Pass this parameter to have all SQL queries that createuser generates displayed to the screen.
Pass this parameter to run in quiet mode; when in quiet mode, the program will not display any results or responses.
Pass this parameter to allow the new user account the ability to create databases.
Pass this paramter to forbid the new user account to create databases.
Pass this parameter to allow the new user account to create other new users.
Pass this parameter to explicitly forbid the new user account the ability to create new users.
Pass this parameter to instruct createuser to prompt for the new user account's password.
Use this parameter to specify a non-default user ID for the new user account. If you do not user this parameter, the system will set the user ID as one more than the last user ID.
Use this parameter to supply the username of the new user account being created. This must be a unique username within the database.
This message is displayed if creation of the user account is successful.
This error is displayed if creation of the user account fails. If an error condition is present, the backend's message will be displayed. This should provide more information about why creation failed. Refer to CREATE USER and psql for more information about possible errors.
Use createuser to create a new user account from the command line. This functions exactly the same as connecting to the PostgreSQL database through psql and issuing the SQL CREATE USER command. Neither of these methods of adding users is better than the other, as they both use the same set of commands.
Your PostgreSQL user account must have permissions to create usersbefore this command will work.
The following example demonstrates how to create a user named jonathan on the default database.
$ createuser jonathan Is the new user allowed to create databases? (y/n) n Shall the new user be allowed to create more new users? (y/n) n CREATE USER