Skip to content

Instantly share code, notes, and snippets.

@mainul35-bs23
mainul35-bs23 / MySQL user grants and Password policy reset.md
Last active September 3, 2020 18:58
MySQL user grants and Password policy reset

Background story

It is a common scenario that we often forget out database password. When we try to log in to our mysql DB, we face the following error message. If we use a password:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

If we don't use a password:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

If you are having trouble installing desktime in any of your linux system,

  1. Extract the desktime debian package
  2. See, there are control.tar.gz, data.tar.xz
  3. Extract the data.tar.xz
  4. In terminal, cd usr cd bin
  5. ls in terminal -> You will see desktime-linux
  6. pwd
  7. Concat the file name with the returned folder location
  8. in terminal cd /usr/bin
  9. sudo ln -s copied_file_location desktime
@mainul35-bs23
mainul35-bs23 / Postgres important commands.md
Created April 23, 2020 06:18
Postgresql important commands for PSQL DB management and queries

Login to PostgreSQL from terminal with Postgres DB user

Note that, in following lines, you have first entered into postgres user't terminal (Of your OS) root Then by using psql command, you have entered into the postgres DB user's shell

[mainul35@localhost ~]$ sudo su postgres
bash-5.0$ psql
could not change directory to "/home/mainul35": Permission denied
psql (11.7)
Type "help" for help.