Last active
March 17, 2024 08:53
-
-
Save SurendraTamang/dad352814412f2f169a865c10970efa6 to your computer and use it in GitHub Desktop.
Cheetsheet for PostGresql learning
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For Restoring the the backup in the given database | |
# While running on docker I first copied the local file to docker container and docker cp and did below | |
psql -U {db_user} -d database_name -f {db}.sql |
sudo docker exec -e PGPASSWORD="" -t {docker_name} pg_dump -U postgres {db} > backuptody.sql
Changing the Password
ALTER USER your_user WITH PASSWORD 'new_password';
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To create a user, a database, and then grant the user permissions to the database in MySQL or PostgreSQL, you'll need administrative access to your database server. The process is slightly different for each database management system. Here's how you can do it in both MySQL and PostgreSQL.
For MySQL
Replace
your_database
with the name of your database.Replace
your_user
with the name of your user andyour_password
with a strong password.For PostgreSQL
Replace
your_database
with the name of your database.Replace
your_user
with the name of your user andyour_password
with a strong password.Remember to replace
your_database
,your_user
, andyour_password
with your actual database name, user name, and password. Also, depending on your specific requirements, you might want to customize the privileges granted to the user.