MySQL Uncategorized

How to reset the root mysql password if you forget it

I’ve been setting up a LEMP server, Nginx Mysql PHP, on Ubuntu and lost my root mysql password. Here’s what I did to reset the password in Terminal.

After logging into my server via SSH on Terminal I ran the following lines in Terminal.

# /etc/init.d/mysql stop
# mysqld_safe --skip-grant-tables &
$ mysql -u root

mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit

# /etc/init.d/mysql stop
# /etc/init.d/mysql start
$ mysql -u root -p

I found this solution in an answer by Benjamin Manns to a StackOverflow question here.


How to remove apps from Mac OS X Lion LaunchPad

Mac OS X Lion LaunchPad

Today I had some apps remain on LaunchPad after deleting them from the applications folder. Apple has some work to do as there was no way of removing these apps from LaunchPad except through terminal. Here is how to use Mac Terminal to remove apps from LaunchPad.

Replace APPNAME with the name of the app. It’s case sensitive.

sqlite3 ~/Library/Application\ Support/Dock/*.db “DELETE from apps WHERE title=’APPNAME’;” && killall Dock

Here’s an example removing Picassa

sqlite3 ~/Library/Application\ Support/Dock/*.db “DELETE from apps WHERE title=’Picassa’;” && killall Dock


Remove dropbox conflicted files on Mac or Linux using Terminal

I like Dropbox. I use it all the time to share files across machines and work on group projects. However, I don’t like how Dropbox duplicates files as and saves them as conflicted copies. It’s not something that I need or use. I just delete those “conflicted” files. 99.99% of the time the conflicted files are not conflicted, Dropbox is just over zealous. Also I use .git to handle my file pushes so I know right away if files have changed. I don’t need Dropbox doing this for me.

I work on a Mac so here is something I run in my terminal to quickly remove those annoying conflicted files.

$ cd dropbox
$ find . -type f -name "* conflicted *" -exec rm -f {} \;