Posts

Showing posts from 2020

MySQL database dump from terminal command

Basic dump command :  mysqldump -u root -p prod_helpdesk > db_backup.sql Dump command with rename file by date time :  mysqldump -u root -p prod_helpdesk > prefix_$(date +%Y-%m-%d-%H.%M.%S).sql

SQL query with multiple database and different tables in Laravel

DB::select("SELECT db1.employees.name AS employee_name, db2.companies.name as company_name FROM db1.employees employees JOIN db2.companies companies ON companies.code = employees.company_code WHERE companies.country = 'Bangladesh' "); Note: Both database users and passwords have to be the same.

Deleted file restoring in git

git log --oneline -- specific-file-name 85b6998 (Take the hash from head) git checkout 85b6998 specific-file-name

PHP mkdir() Permission denied problem solved

Make sure all files are owned by the Apache group and user. In Ubuntu it is the  www-data  group and user. -  chown -R www-data:www-data /path/to/webserver/www Next enabled all members of the www-data group to read and write files. -  chmod -R g+rw /path/to/webserver/www

Delete a local and a remote GIT branch

Delete a local GIT branch - git branch -d branch_name - git branch -D branch_name Delete a remote GIT branch - git push <remote_name> --delete <branch_name>