db.login(1)

πŸ’– db.login β€” the GRASS GIS bestie guide πŸ’–

okay so you found the db.login(1) page in the GRASS GIS User's Manual and honestly? iconic of you. this little guy handles your database login glow-up: user, password, and all the connection settings. let's get into it 🫢


✨ NAME ✨

db.login β€” sets user/password for DB driver/database. that's it, that's the whole job. lowkey essential πŸ’…


🏷️ KEYWORDS 🏷️

database, connection settings


🌸 SYNOPSIS 🌸

db.login
db.login --help
db.login [-p] driver=name database=name  [user=string]
[password=string]   [host=string]   [port=string]   [--overwrite]
[--help]  [--verbose]  [--quiet]  [--ui]

πŸŽ€ Flags πŸŽ€

  • -p β€” print the connection settings and then dip. that's it, that's all it does ✨
  • --overwrite β€” allow output files to overwrite existing files
  • --help β€” print the usage summary
  • --verbose β€” verbose module output (she's chatty)
  • --quiet β€” quiet module output (she's mysterious)
  • --ui β€” force launching the GUI dialog

πŸ¦‹ Parameters πŸ¦‹

  • driver=name [required] β€” the name of your database driver.
    • Options: dbf, mesql, mysql, odbc, ogr, pg, sqlite
    • Default: sqlite
  • database=name [required] β€” the name of your database.
    • Default: $GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db
  • user=string β€” your username
  • password=string β€” your password
  • host=string β€” the hostname. relevant only for the pg and mysql drivers, no cap
  • port=string β€” the port. also only relevant for pg and mysql

πŸ’œ DESCRIPTION πŸ’œ

so like, db.login sets login parameters β€” things like your user name, and optionally a password, a hostname, or a port β€” for connecting to the database you picked, through that DB driver. it's basically setting up your lil connection fit before you go out 🌈


🚨 NOTE 🚨

the host and port options are related to only SQL database backends, like PostgreSQL, MySQL or ODBC. so if you're not on one of those, don't stress about them bestie.

⚠️ okay this part matters, listen up: the passwords are stored in a hidden, unencrypted file in the user account. unencrypted. not encrypted. we're saying it twice because it's important. specifically it lives: - in the 'home' directory, i.e. $HOME/.grass8/dblogin on Unix-like systems - %APPDATA%\Roaming\GRASS8\dblogin on MS-Windows only the file owner can access this file. πŸ’€ but still. unencrypted. you've been warned.

πŸ”₯ EXAMPLES πŸ”₯

only username specified (this is assuming a locally accessible PostgreSQL DB with no password):

db.login driver=pg database=mydb

username, password and hostname all specified β€” and heads up, the command lines history will store the password this way:

db.login driver=pg database=mydb user=bacava password=secret host=db.example.com

username with an empty password specified:

db.login driver=pg database=mydb user=bacava password=""

πŸ‘€ SEE ALSO πŸ‘€

db.connect, db.test, db.tables

SQL support in GRASS GIS


πŸ‘‘ AUTHOR πŸ‘‘

Radim Blazek

Support for hostname and port by Martin Landa, OSGeoREL, Czech Technical University in Prague, Czech Republic (GRASS 7.1) β€” slay 🫢


🧚 SOURCE CODE 🧚

Available at: db.login source code (history)

Accessed: Saturday Jan 17 05:40:33 2026

Main index | Database index | Topics index | Keywords index | Graphical index | Full index


and that's the whole page bestie, you ate πŸ’…βœ¨ mwah πŸ’–

this was GRASS 8.4.2, the db.login(1) page from the GRASS GIS 8.4.2 Reference Manual, Β© 2003-2025 GRASS Development Team β€” go forth and connect responsibly πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from