Friday, February 26, 2010

How to set the MySQL Default Storage Engine with MAMP

The MySQL server of MAMP and MAMP PRO uses the Default Storage Engine MyISAM. If you want to change this, you have to change the configuration file of the MySQL server. With this tutorial we want to show you how to manage this. As Default Storage Engine we are using InnoDB.

MAMP:
  1. Stop the MAMP Server if it is running.
  2. Use a texteditor to create a file named "my.cnf" and save it to the "/Applications/MAMP/conf/" folder.
  3. Add the following lines into the file:

    [mysqld]
    default-storage-engine = InnoDB

  4. Save the file and close your editor.
  5. Start the MAMP servers.
MAMP PRO:
  1. Start MAMP PRO.
  2. Stop the MAMP PRO server if it is running.
  3. Select File -> Edit Template -> MySQL my.cnf
  4. An editor window appears.
  5. If a warning message appears confirm with OK.
  6. Find the section "[mysqld]"
  7. Beneath the last line of this section add this line:

    default-storage-engine = InnoDB

  8. The section "[mysqld]" now looks like this:



  9. Save (Apple + S) all changes made on "my.cnf"
  10. Close the editor window (Apple + W)
  11. Start the MAMP PRO servers.

How-to check if the modifications succeeded. Servers of MAMP / MAMP PRO must be running.
  • Open Terminal (Applications/Utilities)
  • Enter the following line into the terminal and hit Enter:

    /Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot

  • Enter the following line into the MySQL prompt and hit Enter:

    USE information_schema;

  • Enter the following line into the MySQL prompt and hit Enter:

    SELECT * FROM engines;

  • A table with the storage Engines of MySQL will show up. Inside the Support column "InnoDB" now has the value "DEFAULT". InnoDB now is the default Storage Engine of the MySQL Server.

  • Enter the following line into the MySQL prompt and hit Enter:

    exit;

Share/Save/Bookmark