Using query to alter sysmail servername in SQL SERVER 2012

to check db mail server configuration:

select * from
msdb.dbo.sysmail_account sa 
left join msdb.dbo.sysmail_server ss
on ss.account_id = sa.account_id;

to update the servername for an existing account:

exec msdb.dbo.sysmail_update_account_sp
@account_id = #,
@mailserver_name = 'something the resolves to an IP within your network';

GIT checkout from tag

git fetch origin
git checkout -b temp tagname

GIT diff branches, apply diff

git diff up-to-date-branch old-branch > code.diff
git apply code.diff

GIT rebase

git checkout feature-branch
git checkout -b master-rebase
git rebase -i master

(pick the first commit and squash the rest of the commits)

during merge conflicts:
git checkout --theirs .
git add .
git rebase --continue

ff merge:
git checkout master
git merge master-rebase

cleanup:
git branch -D master-rebase

----------------------------
.. to overwrite current branch1 with branch2

git checkout branch2
git merge -s ours branch1

.. this effectively makes branch1 = branch2

.. now to fast forward branch1 to sync the branches

git checkout branch1
git merge branch2

GIT force take branch changes

Situation:

[origin/branch1]  [branch1]    took only partial changes from branch2 during merge
[origin/branch2]  [branch2]    has changes 1, 2, 3


In other words, branch1 has only done a partial merge of branch2. As such branch2 has changes that are 'newer' than branch1. You can complete the merge with the following commands.

git checkout branch1
git merge branch2

But this isn't what you want. You left out those merges on purpose. In this case, you know that branch1 is up-to-date (even though it has left out some files from branch2). What you really want to do is to overwrite branch2 with branch1. You can do this with the following commands.

git checkout branch1 # branch missing files
git merge -s ours branch2 # branch with unnecessary changes


OMFG GIT REBASE

Situation:

[origin/branch1]  [branch1]  some commit message
[origin/branch2]  [branch2]  another commit message

git checkout branch1
git rebase branch2

oops...

[origin/branch1]  some commit message
[origin/branch2]  [branch2]  [branch1]   another commit message

to undo this:

git checkout branch1
git fetch origin
git reset --hard origin/branch1


OSX Launching mysql at startup in Yosemite

This assumes that you installed mysql using homebrew (ie. brew install mysql)


ln -sfv /usr/local/opt/mysql/*.plist /Library/LaunchDaemons

# to manualy start the service
# sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.mysql.plist

Gotta make sure it's got the right permissions:
sudo chown root:wheel /Library/LaunchDaemons/homebrew.mxcl.mysql.plist
sudo chmod 644 /Library/LaunchDaemons/homebrew.mxcl.mysql.plist


Contents of the homebrew.mxcl.mysql.plist file:


  1 <?xml version="1.0" encoding="UTF-8"?>
  2 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple
  3 <plist version="1.0">
  4 <dict>
  5   <key>KeepAlive</key>
  6   <true/>
  7   <key>Label</key>
  8   <string>homebrew.mxcl.mysql</string>
  9   <key>ProgramArguments</key>
 10   <array>
 11     <string>/usr/local/opt/mysql/bin/mysqld_safe</string>
 12     <string>--user=root</string>
 13     <string>--socket=<socket filepath></string>
 14     <string>--pid-file=<pid filepath></string>
 15     <string>--bind-address=127.0.0.1</string>
 16     <string>--datadir=<data directory></string>
 17   </array>
 18   <key>RunAtLoad</key>
 19   <true/>
 20   <key>WorkingDirectory</key>
 21   <string>/usr/local/var</string>
 22 </dict>
 23 </plist>

Reinstalling homebrew (Yosemite update)

# clean up homebrew
rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup

# reinstall homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

# recommended
brew doctor
cd /usr/local/Library && git stash && git clean -d -f

now you can start clean again with homebrew:

ie. brew install mysql

MySql Hell: error! the server quit without updating pid file

First I have to note that several other developers have recommended removing the .err file, or renaming the ib_logfile## files. Obviously this didn't work for me or else I wouldn't be writing this post.


This issue started occurring once I placed my.cnf into the /etc directory.

The best way to see what's actually happen is to open the err file and debug. You can specify the location of the log file via:

[mysqld]
datadir = /usr/local/mysql

With the above setting, your log file will be:
/usr/local/mysql/.err



In my case it was actually a permissions issue. My database uses a non-standard socket setting (to match linux environment). I also disabled the root access, and have specific credentials that mysqld and mysql needs during startup. That said, my my.cnf file looks as follows:

[client]
user=myuser
password=mypassword

[mysqld]
user=sysuser
pid-file=/path/to/mysqld.pid
socket=/path/to/mysqld.sock
port=3306
datadir=/dir/for/mysql/data
tmpdir=/tmp
general_log_file=/tmp/logs/mysql.log
log_bin=/tmp/logs/mysql-bin.log
# DO NOT USE THIS NEXT LINE OR YOUR DB WILL BE LOCKED IN READ ONLY MODE
# innodb_force_recovery = 1


It's important to note that sysuser is actually the user who OWNS the directories on your system (ie. root or yourMacUserName), not to be confused with your mysql users. So, in my case, I would also need to make sure that the datadir, pid-file-dir, socket-dir, and log-dir are all accessible (via chown) by 'sysuser'.


now try starting the db via: sudo mysql.server start