21

As I would like to move those files from one server to another server, while the database is offline.

8 Answers 8

21

It should be stored in: /usr/local/mysql/data

1
  • Just as a note, this is where it was stored when I installed MySQL using their actual GUI installer rather than via Homebrew. There are quite a lot of different ways of installing it! Aug 10, 2016 at 8:27
25

When you use mysql installed via Homebrew, you should find your database folders and files in /usr/local/var/mysql

1

OS X Server (at least v10.6) keeps the database in /var/mysql by default. You can change this in Server Admin -> MySQL service -> Settings -> Database location (note that editing this field doesn't actually move the data, just changes where it's loaded from).

0

I don't have access to my Mac right now, so can't say for certain. Why not simply search (from Terminal, not Spotlight) the file system for "mysql", as there will always be a table named mysql.

0

Look for the my.cnf file - should be in the /etc/ directory and then look for a line like:

datadir=/var/lib/mysql

The datadir is where mysql stores all the database files.

Autobyte

0

If you've installed MySQL by running MAMP on the Mac, then the files are stored at /Applications/MAMP/db/mysql

For MAMP Pro, the files should be in /Library/Application Support/appsolute/MAMP PRO/db/mysql

Stack Overflow answer that addresses MAMP / Sequel Pro installations here: https://stackoverflow.com/questions/7341897/where-does-sequel-pro-mamp-store-local-databases

0

With respect to a Homebrew installed MySQL (in my case its v5.7 which is not the latest default of version 8) on Mac Catalina, the following applies (at least for a keg):

  • The default config file is here: /usr/local/etc/my.cnf
  • The default loc for the db is here: /usr/local/var/mysql

When starting the server, you have some options to do it:

  • Use the brew startup: brew services start mysql
  • Or, that's equivalent to: /usr/local/opt/mysql/bin/mysqld_safe --datadir=/usr/local/var/mysql

If you're using a specific version of mysql (in my case I'm using v5.7 and thus its a keg-only install), the service name is mysql@5.7 and the bin path is /usr/local/opt/mysql@5.7

0

On macOS Monterey v. 12.6, mysql v. 8.0.31 - installed via with Homebrew 3.6.7 - keeps its databases under /opt/homebrew/var/mysql.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.