Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysql2::Error: Can't read dir - after reinstall of mysql from homebrew on OS X

My previous install of MySQL on OS X was done manually with the native package installer.

Someone was helping me with an issue I had with upgrading some gems, and in process they installed mysql from the homebrew tools.

Since that point, I'm unable to access any of my local databases from MySQLWorkbench or from my various rails apps, but logging in with mysql on CLI using the same credentials allows me to read and write to all tables as normal.

The error I'm receiving from rails when I try to load a page is:

Mysql2::Error: Can't read dir of './r4/' (errno: 13): SHOW TABLES LIKE 'schema_migrations'

Any ideas as to what I can do to fix that?

like image 410
bdx Avatar asked Dec 16 '22 05:12

bdx


1 Answers

Found the issue - permissions had changed on the /usr/local/mysql/data folder, I had to run:

cd /usr/local/mysql/data

sudo chown -R _mysql mysql*

* Note: Replace mysql* with the directory/directories causing the error. *

like image 65
bdx Avatar answered Feb 12 '23 11:02

bdx