4,461
edits
iwu |
add more sections |
||
Line 30: | Line 30: | ||
postgres=# grant all privileges on database mydb to dbuser; | postgres=# grant all privileges on database mydb to dbuser; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== Listing DBs == | |||
You can list the DBs. | |||
MySQL: | |||
<syntaxhighlight lang="mysql"> | |||
mysql> show databases; | |||
</syntaxhighlight> | |||
PostgreSQL: | |||
<syntaxhighlight lang="psql"> | |||
postgres=# \l | |||
</syntaxhighlight> | |||
== selecting a DB == | |||
You can select a DB. | |||
MySQL: | |||
<syntaxhighlight lang="mysql"> | |||
mysql> use mydb; | |||
</syntaxhighlight> | |||
PostgreSQL: | |||
<syntaxhighlight lang="psql"> | |||
postgres=# \connect mydb; | |||
</syntaxhighlight> | |||
After selecting a DB you can go ahead and execute SQL commands. | |||
== Exiting from DB == | == Exiting from DB == | ||
Ctrl-D should exit from both. | Ctrl-D should exit from both. |