2

I am trying to set up a dev environment on my Mac laptop, and I have run into some trouble when installing mysql. When I try to create a database, I get the following error:

ERROR 1006 (HY000): Can't create database 'SummerGypsy_development' (errno: 2

From what I have gathered, this means there was some problem in creating the database on the disc.

Here is how I installed mysql:

First, using Homebrew, I executed:

brew install mysql

Once that finished, I tried running mysql_install_db, but got an error. To remedy this error, I ended up running

mysql_install_db --basedir=/usr/local/

I can run mysql, but creating a database does not work. I ran

mysqladmin variables | grep datadir

To find where mysql was trying to create the database. The output was: /usr/local/mysql/data

/usr/local/mysql and /usr/local/mysql/data directories do not actually exist, and I have a feeling that the datadir is pointing here because of the basedir I passed into mysql_install_db. As a quick fix, I tried creating both directories, and then running

chown -R mysql:mysql /usr/local/mysql

to give mysql permissions in this directory. This did not fix the problem, though.

Does anyone have any suggestions?

Max
  • 15,157
  • 17
  • 82
  • 127

3 Answers3

2

you need to change the permissions in the data.

chown -R mysql:mysql /usr/local/mysql/data
laalto
  • 150,114
  • 66
  • 286
  • 303
Marco
  • 21
  • 2
1

You might want to try installing from the .dmg file (installer, system preferences pane, and startup script) that is distributed directly from MySQL. There is a thread on Getting MySQL work on OSX 10.7 Lion that you might want to take a look at. These steps helped me get MySQL running on OSX Lion. Hope this helps.

Community
  • 1
  • 1
Travis Nelson
  • 2,590
  • 5
  • 28
  • 34
0

I tried lot of the suggestions including the file permission reset with no luck. But i then restarted the mysql using the command "./mysqld_safe &" (excluding quotes) and it worked.

Yoosaf Abdulla
  • 3,722
  • 4
  • 31
  • 34