Updated PostgreSQL Storage (markdown)

aurorapar 2024-03-28 02:47:30 -05:00
parent f3c92b4805
commit 2248e97ae0

@ -16,19 +16,44 @@ You will notice statements like "CREATE DATABASE" after entering a command. This
postgres=# CREATE DATABASE <DATABASE_NAME>; postgres=# CREATE DATABASE <DATABASE_NAME>;
CREATE DATABASE CREATE DATABASE
<details>
<summary>Postgres example (Click to expand)</summary>
<pre><code>C:\Program Files\PostgreSQL\15\bin>psql -U postgres
Password for user postgres:
postgres=# CREATE DATABASE dynmap;
CREATE DATABASE</code></pre>
</details>
### Add new users ### Add new users
**note:** **note:**
If the Postgres server is on the same server as the minecraft server. <minecraftserver_ip> should just be localhost If the Postgres server is on the same server as the minecraft server. <minecraftserver_ip> should just be localhost
<pre><code>postgres=# CREATE USER <DYNMAP_USER> WITH PASSWORD '<DYNMAP_USER_PASSWORD>'; <pre><code>postgres=# CREATE USER &lt;DYNMAP_USER&gt; WITH PASSWORD '<DYNMAP_USER_PASSWORD>';
CREATE ROLE
postgres=# ALTER DATABASE &lt;DYNMAP_DATABASE&gt; OWNER TO &lt;DYNMAP_USER&gt;;
ALTER DATABASE</code></pre>
<details>
<summary>Postgres example (Click to expand)</summary>
<pre><code>postgres=# CREATE USER dynamp WITH PASSWORD 'CHANGE_ME_QUICK';
CREATE ROLE CREATE ROLE
postgres=# ALTER DATABASE dynmap OWNER TO dynmap; postgres=# ALTER DATABASE dynmap OWNER TO dynmap;
ALTER DATABASE</code></pre> ALTER DATABASE</code></pre>
</details>
If you made a mistake and need to delete the user, this is how. If you made a mistake and need to delete the user, this is how.
<pre><code>postgres=# DROP USER <DYNMAP_USER>;</pre></code> <pre><code>postgres=# DROP USER <DYNMAP_USER>;</pre></code>
<details>
<summary>Postgres example (Click to expand)</summary>
<pre><code>postgres=# DROP USER dynmap;</pre></code>
A note: You can do this for databases, schemas (dynmap doesn't use any I believe), and users. If you play around with this, you may permanently lose data.
<pre><code>postgres=# DROP DATABASE dynmap;
postgres=# DROP SCHEMA maps;<pre></code>
</details>
After you create a new user, try logging into the user. (after you logout from the postgres user via "exit") After you create a new user, try logging into the user. (after you logout from the postgres user via "exit")
<pre><code>postgres -u <DYNMAP_USER> <pre><code>postgres -u <DYNMAP_USER>