I installed mysql in Mac after downloding 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.
See if you have a file located under
/etc/my.cnf
. If so, it should tell you where the data directory is.For example:
My guess is that your mysql might be installed to /usr/local/mysql-XXX.
You may find these MySQL reference manual links useful:
Well, if yo don't know where is my.cnf (such Mac OS X installed with homebrew), or You are looking found others choices:
You get
datadir=/usr/local/var/mysql
If the software is Sequel pro the default install mysql on Mac OSX has data located here:
If you are using macOS {mine 'High Sierra'} and Installed XAMPP
You can find mysql data files;
Go to :
/Applications/XAMPP/xamppfiles/var/mysql/
As suggested, I edited this message to place a proper answer.
The 'physical' location of the mysql databases are under /usr/local/mysql
the mysql is a symlink to the current active mysql installation, in my case the exact folder is mysql-5.6.10-osx10.7-x86_64.
Inside that folder you'll see another data folder, inside it are RESTRICTED folders with your databases.
You can't actually see the size of your databases (that was my issue) from the Finder because the folder are protected, you can though see from the terminal with
sudo du -sh /usr/local/mysql/data/{your-database-name}
and like this you'll get a nice formatted output with the size.In those folder you have different files with all the folders present in your database, so it's safer to check the db's folder to get a size.
That's it. Enjoy!
Check where is the root folder of mysql with: