I'm having issues with getting mysql installed properly under homebrew. I want homebrew to manage it, and I had it installed manually using the .dmg installer beforehand. I've backed up my data into an sql file.

I uninstalled all versions of mysql including my homebrew version. No mysql versions anywhere. So then I use homebrew to install mysql and it installs. I log in using root, and I try to create a database:

mysql> create database `fem`;
ERROR 1006 (HY000): Can't create database 'fem' (errno: 2)

I keep getting that error.

So I look where the data is kept:

$ mysqladmin -u username -ppassword VARIABLES | grep datadir
| datadir             | /usr/local/mysql/data/

But there is no /usr/local/mysql directory. I ask which mysql it's using and it replies:

/usr/local/bin/mysql

...which is an alias to the Cellar mysql, which is proper. I'm thinking for some reason it's looking at the wrong location for the data. I'm not sure where homebrew's mysql data directory is supposed to be. I don't have any my.cnf files anywhere, and I've never used one, just default setup.

Any advice appreciated how I fix this stuff.

Cheers

migrated from stackoverflow.com Aug 11 '15 at 8:29

This question came from our site for professional and enthusiast programmers.

  • Did you try running brew doctor? It might provide some helpful information. – Marko Grešak Aug 10 '15 at 23:53
  • Yes. My system is ready to brew. Everything seems perfect outside of not working. – Rich_F Aug 10 '15 at 23:57
  • I know this was migrated from SO, but you might get better responses at apple.stackexchange. – Raystafarian Aug 11 '15 at 8:31
  • @Raystafarian right, good call. Thanks. – Rich_F Aug 11 '15 at 10:08

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.