Alex Rivera | Logout

MySQL data directory location

Asked 2011-09-18T02:23:51.263
94

I installed MySQL on a Mac after downloading its DMG file version 64 bit.

While trying to create a database it gave me error 1006 -- can't create database. After browsing a number of website, it seems due to user ownership setting of MySQL "data directory" location that needs to be changed.

Where is MySQL default data directory? I could not find /var/lib/mysql in localhost.

THANKS.

Edit
Report

1 Answer

61

See if you have a file located under /etc/my.cnf. If so, it should tell you where the data directory is.

For example:

[mysqld]
set-variable=local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
...

My guess is that your mysql might be installed to /usr/local/mysql-XXX.

You may find these MySQL reference manual links useful:

answered 2011-09-18T02:33:39.060

Your Answer