Search code examples
mysqlosx-mountain-lionhomebrew

Change mysql db location when installed with homebrew


I just installed mysql via homebrew and I wanted to change the location where mysql stores the databases. All the stuff I've found so far online have paths that I don't understand and don't exist on my machine (OSX 10.8).

Any help is greatly appreciated. Thanks.


Solution

  • If you have MySQL running a simple ps ax | grep mysql will yeld the process path.

    Otherwise search your fs for mysqld it will take some time but will get the job done:

    sudo find / -type f -name "mysqld"
    

    A find / | grep mysql will print every file containing mysql in its name.

    Use MySQLWorkbench, it has a nice GUI which lets you configure INNODBs data path and will also help you managing your instances.

    Otherwise edit /etc/my.cnf (or create it if you don't have any) insert a [mysqld] section and set innodb_data_home_dir = /path/to/where/you/moved/your/data

    [mysqld]
    innodb_data_home_dir = /path/to/where/you/moved/your/data