Dumping drupal DB without cache tables

If you want to dump DB from production or develop servers and not include cache table values for faster importing you can use below script. You need to change site_name variable and DUMPDIR to match what you have and also user/password of DB

Bash script for cloning database on server

If you need to copy DB, lets say from production to develop you can use this script and call it like "develclone.sh original_db cloned_db"
For faster cloning it will exclude cache tables data.

Delete stale CSS and JS files faster

To delete stale CSS and JS files from server, you need to add

variable_set('drupal_stale_file_threshold', 86400);

to your settings.php and change the value from default 30 days (2592000) to for example 1 day above.
They will be deleted on cron run.

Importing zip mysql dump

zcat /Users/Marko/Downloads/file.sql.gz | mysql -u 'root' -p'password' your_database

just drop this line in your linux or mac and fill data you need to fill and wait :) or this for gz files

gunzip < /Users/Marko/Downloads/mydb.sql.gz | mysql -u root -p mydb

or for ZIP files

Git logs, find where it went wrong

When I want to find something in GIT and see who and when removed some code I start to search GIT, best command combo is this.

 git log -S "$location['country_code']" -p

For current branch

Logging mysql on localhost

In mysql 5.6+. Use this:

[mysqld]
general_log = on
general_log_file=/usr/log/general.log

in your my.cnf / my.ini file

DB Uploading from local to remote

mysqldump -u user -p databasename > dump.sql

Then using SCP transfer the file to the remote server:

scp dump.sql user@remotehost.ip:

Then use the mysql client there to import the dump.sql with:

mysql -u user_name -p databasename < dump.sql

Choosing which PHP to run with Drush, changing CLI php

Using drush on mac with mamp gave me some problems with default setup. I didnt set
DRUSH_PHP variable anywhere so default php was used, also with that no php.ini setting was set and in my drush status I got empty "Drush configuration" variable. So to set this up, I needed to add this to either .profile or to .bash_profile (depends of load order, later goes first if you have it)