Databases: Difference between revisions
From Cheatsheet
Jump to navigationJump to search
(Created page with "Cheatsheets == MYSQL+MARIADB == <syntaxhighlight lang="bash"> # Log into the MySQL CLI mysql -u root -p # Show all tables in the database SHOW TABLES; # Exit the MySQL CLI exit </syntaxhighlight> == Postgres == <syntaxhighlight lang="bash"> # Log into the Postgres CLI psql # List all databases \l # Connect to a database -d mydatabase -U databaseuser –W # Switch to the new database connection \c mydatabase databaseuser # List all tables \...") |
|||
| Line 1: | Line 1: | ||
[[Category:Cheatsheet|Cheatsheets]] | [[Category:Cheatsheet|Cheatsheets]] | ||
== MYSQL | == MYSQL / MARIADB == | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
# | # Activate the MySQL CLI (as user with proper permission) | ||
mysql | |||
# Authenticate into the MySQL CLI | |||
mysql -u root -p | mysql -u root -p | ||
# Show all databases; | |||
SHOW DATABASES; | |||
# Show all tables in the database | # Show all tables in the database | ||
Revision as of 08:35, 23 August 2023
MYSQL / MARIADB
# Activate the MySQL CLI (as user with proper permission) mysql # Authenticate into the MySQL CLI mysql -u root -p # Show all databases; SHOW DATABASES; # Show all tables in the database SHOW TABLES; # Exit the MySQL CLI exit
Postgres
# Log into the Postgres CLI psql # List all databases \l # Connect to a database -d mydatabase -U databaseuser –W # Switch to the new database connection \c mydatabase databaseuser # List all tables \dt # Quit the Postgres CLI \q