I was trying to install homebrew and very very stupidly did this:
sudo chown -R $USER /usr/local
The Homebrew instructions say to do this and I'm not much of a sysadmin so I took their word for it. Lesson learned (although I wouldn't really know how to test this...seems like an "undo" script would be super valuable here)
Anyway, what is done is done, but now I get this error:
$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 548
Server version: 5.1.33 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databases;
ERROR 1018 (HY000): Can't read dir of '.' (errno: 13)
I tried chown-ing back to root with no avail. Does anyone know how I can fix this without reinstalling mysql? Optionally, if I have to reinstall mysql, how can I dump my databases without access to the command line so I don't lose all of my data.
Thanks!
Find mysql's data directory, and chown that to MySQL's user (typically mysql:mysql)...
Determine what user mysql is running as (I'd use
ps aux |grep mysql
, but your flags to ps might differ), find where mysql is installed (mine shows in the ps results as--datadir=/usr/local/mysql/data
, but you might need your screen to be wide enough so it's not truncating the command), and then change the ownership back to the correct user.data/
is a directory under/usr/local/mysql/
which contains all the database.Now do
mysql -u user -p password
. You can access your database