gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 line
11KB

  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>dropuser</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="prev" href="app-dropdb.html" title="dropdb" /><link rel="next" href="app-ecpg.html" title="ecpg" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center"><span xmlns="http://www.w3.org/1999/xhtml" class="application">dropuser</span></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="app-dropdb.html" title="dropdb">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="reference-client.html" title="PostgreSQL Client Applications">Up</a></td><th width="60%" align="center">PostgreSQL Client Applications</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="app-ecpg.html" title="ecpg">Next</a></td></tr></table><hr></hr></div><div class="refentry" id="APP-DROPUSER"><div class="titlepage"></div><a id="id-1.9.4.7.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle"><span class="application">dropuser</span></span></h2><p>dropuser — remove a <span class="productname">PostgreSQL</span> user account</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p id="id-1.9.4.7.4.1"><code class="command">dropuser</code> [<em class="replaceable"><code>connection-option</code></em>...] [<em class="replaceable"><code>option</code></em>...] [<em class="replaceable"><code>username</code></em>]</p></div></div><div class="refsect1" id="id-1.9.4.7.5"><h2>Description</h2><p>
  3. <span class="application">dropuser</span> removes an existing
  4. <span class="productname">PostgreSQL</span> user.
  5. Only superusers and users with the <code class="literal">CREATEROLE</code> privilege can
  6. remove <span class="productname">PostgreSQL</span> users. (To remove a
  7. superuser, you must yourself be a superuser.)
  8. </p><p>
  9. <span class="application">dropuser</span> is a wrapper around the
  10. <acronym class="acronym">SQL</acronym> command <a class="xref" href="sql-droprole.html" title="DROP ROLE"><span class="refentrytitle">DROP ROLE</span></a>.
  11. There is no effective difference between dropping users via
  12. this utility and via other methods for accessing the server.
  13. </p></div><div class="refsect1" id="id-1.9.4.7.6"><h2>Options</h2><p>
  14. <span class="application">dropuser</span> accepts the following command-line arguments:
  15. </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>username</code></em></span></dt><dd><p>
  16. Specifies the name of the <span class="productname">PostgreSQL</span> user to be removed.
  17. You will be prompted for a name if none is specified on the command
  18. line and the <code class="option">-i</code>/<code class="option">--interactive</code> option
  19. is used.
  20. </p></dd><dt><span class="term"><code class="option">-e</code><br /></span><span class="term"><code class="option">--echo</code></span></dt><dd><p>
  21. Echo the commands that <span class="application">dropuser</span> generates
  22. and sends to the server.
  23. </p></dd><dt><span class="term"><code class="option">-i</code><br /></span><span class="term"><code class="option">--interactive</code></span></dt><dd><p>
  24. Prompt for confirmation before actually removing the user, and prompt
  25. for the user name if none is specified on the command line.
  26. </p></dd><dt><span class="term"><code class="option">-V</code><br /></span><span class="term"><code class="option">--version</code></span></dt><dd><p>
  27. Print the <span class="application">dropuser</span> version and exit.
  28. </p></dd><dt><span class="term"><code class="option">--if-exists</code></span></dt><dd><p>
  29. Do not throw an error if the user does not exist. A notice is
  30. issued in this case.
  31. </p></dd><dt><span class="term"><code class="option">-?</code><br /></span><span class="term"><code class="option">--help</code></span></dt><dd><p>
  32. Show help about <span class="application">dropuser</span> command line
  33. arguments, and exit.
  34. </p></dd></dl></div><p>
  35. </p><p>
  36. <span class="application">dropuser</span> also accepts the following
  37. command-line arguments for connection parameters:
  38. </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-h <em class="replaceable"><code>host</code></em></code><br /></span><span class="term"><code class="option">--host=<em class="replaceable"><code>host</code></em></code></span></dt><dd><p>
  39. Specifies the host name of the machine on which the
  40. server
  41. is running. If the value begins with a slash, it is used
  42. as the directory for the Unix domain socket.
  43. </p></dd><dt><span class="term"><code class="option">-p <em class="replaceable"><code>port</code></em></code><br /></span><span class="term"><code class="option">--port=<em class="replaceable"><code>port</code></em></code></span></dt><dd><p>
  44. Specifies the TCP port or local Unix domain socket file
  45. extension on which the server
  46. is listening for connections.
  47. </p></dd><dt><span class="term"><code class="option">-U <em class="replaceable"><code>username</code></em></code><br /></span><span class="term"><code class="option">--username=<em class="replaceable"><code>username</code></em></code></span></dt><dd><p>
  48. User name to connect as (not the user name to drop).
  49. </p></dd><dt><span class="term"><code class="option">-w</code><br /></span><span class="term"><code class="option">--no-password</code></span></dt><dd><p>
  50. Never issue a password prompt. If the server requires
  51. password authentication and a password is not available by
  52. other means such as a <code class="filename">.pgpass</code> file, the
  53. connection attempt will fail. This option can be useful in
  54. batch jobs and scripts where no user is present to enter a
  55. password.
  56. </p></dd><dt><span class="term"><code class="option">-W</code><br /></span><span class="term"><code class="option">--password</code></span></dt><dd><p>
  57. Force <span class="application">dropuser</span> to prompt for a
  58. password before connecting to a database.
  59. </p><p>
  60. This option is never essential, since
  61. <span class="application">dropuser</span> will automatically prompt
  62. for a password if the server demands password authentication.
  63. However, <span class="application">dropuser</span> will waste a
  64. connection attempt finding out that the server wants a password.
  65. In some cases it is worth typing <code class="option">-W</code> to avoid the extra
  66. connection attempt.
  67. </p></dd></dl></div><p>
  68. </p></div><div class="refsect1" id="id-1.9.4.7.7"><h2>Environment</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">PGHOST</code><br /></span><span class="term"><code class="envar">PGPORT</code><br /></span><span class="term"><code class="envar">PGUSER</code></span></dt><dd><p>
  69. Default connection parameters
  70. </p></dd><dt><span class="term"><code class="envar">PG_COLOR</code></span></dt><dd><p>
  71. Specifies whether to use color in diagnostic messages. Possible values
  72. are <code class="literal">always</code>, <code class="literal">auto</code> and
  73. <code class="literal">never</code>.
  74. </p></dd></dl></div><p>
  75. This utility, like most other <span class="productname">PostgreSQL</span> utilities,
  76. also uses the environment variables supported by <span class="application">libpq</span>
  77. (see <a class="xref" href="libpq-envars.html" title="33.14. Environment Variables">Section 33.14</a>).
  78. </p></div><div class="refsect1" id="id-1.9.4.7.8"><h2>Diagnostics</h2><p>
  79. In case of difficulty, see <a class="xref" href="sql-droprole.html" title="DROP ROLE"><span class="refentrytitle">DROP ROLE</span></a>
  80. and <a class="xref" href="app-psql.html" title="psql"><span class="refentrytitle"><span class="application">psql</span></span></a> for
  81. discussions of potential problems and error messages.
  82. The database server must be running at the
  83. targeted host. Also, any default connection settings and environment
  84. variables used by the <span class="application">libpq</span> front-end
  85. library will apply.
  86. </p></div><div class="refsect1" id="id-1.9.4.7.9"><h2>Examples</h2><p>
  87. To remove user <code class="literal">joe</code> from the default database
  88. server:
  89. </p><pre class="screen">
  90. <code class="prompt">$ </code><strong class="userinput"><code>dropuser joe</code></strong>
  91. </pre><p>
  92. </p><p>
  93. To remove user <code class="literal">joe</code> using the server on host
  94. <code class="literal">eden</code>, port 5000, with verification and a peek at the underlying
  95. command:
  96. </p><pre class="screen">
  97. <code class="prompt">$ </code><strong class="userinput"><code>dropuser -p 5000 -h eden -i -e joe</code></strong>
  98. <code class="computeroutput">Role "joe" will be permanently removed.
  99. Are you sure? (y/n) </code><strong class="userinput"><code>y</code></strong>
  100. <code class="computeroutput">DROP ROLE joe;</code>
  101. </pre></div><div class="refsect1" id="id-1.9.4.7.10"><h2>See Also</h2><span class="simplelist"><a class="xref" href="app-createuser.html" title="createuser"><span class="refentrytitle"><span class="application">createuser</span></span></a>, <a class="xref" href="sql-droprole.html" title="DROP ROLE"><span class="refentrytitle">DROP ROLE</span></a></span></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="app-dropdb.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-client.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="app-ecpg.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="application">dropdb</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="application">ecpg</span></td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1