Not Every Linux Command Is Good for You

Screen Shot 2016-03-24 at 9.27.42 AM

This is something I ran into lately on my Mac.  I know what you’re thinking . . . um, that’s not a Linux.  You’re right, but using the line command can still mess things up if you don’t know what you’re doing.  Messed up stuff is exactly what I did.

While trying to configure Compass and Sass to work with grunt I found some stupid suggestion to perform the following command:

sudo chown -R $(whoami):admin /usr/local

 

The problem with this is that not only did it not fix my Compass and Sass configuration issues, it messed up the permissions of my MySQL database tables.  My local WordPress sites stopped working and I couldn’t access my data using PHPMyAdmin.  “Oh crap! Now what?,” I thought.  After my initial panic, I realized I just need to figure out what my permissions used to be and set them back.

On my Mac, my data for MySQL is located at /usr/local/mysql-5.7.9-osx10.9-x86_64 and an alias /usr/local/mysql -> /usr/local/mysql-5.7.9-osx10.9-x86_64.

To set the permissions back I did the following commands:

sudo su -
chown root:wheel /usr/local/mysql
chown -R root:wheel /usr/local/mysql-5.7.9-osx10.9-x86_64/
cd /usr/local/mysql-5.7.9-osx10.9-x86_64/
chown -R _mysql:wheel data

 

There we go, back to normal