MySQL - convert InnoDB to MyISAM
From SugarCRM Wiki
If you would like to convert your entire Sugar Instance to MyISAM instead of InnoDB, please follow the instructions below:
- Copy the code below
- Paste it into a text file
- Save the file as convertToMyISAM.php
- Move the file into your SugarCRM root directory
- In your web browser, go to http://<your_server>/<sugar_dir>/convertToMyISAM.php
- Follow the instructions on that page to convert everything to MyISAM
<?php
require_once("config.php");
global $sugar_config;
$db_type = $sugar_config['dbconfig']['db_type'];
$link = mysql_connect( $sugar_config['dbconfig']['db_host_name'],
$sugar_config['dbconfig']['db_user_name'],
$sugar_config['dbconfig']['db_password'] );
if(!$link){
echo "Could not connect to database. Make sure the config.php ".
"has the correct values set."; die();
}
mysql_select_db($sugar_config['dbconfig']['db_name'], $link);
$result = mysql_query("show tables");
$tablearr = array();
while($row = mysql_fetch_row($result)){
$tablearr[] = $row[0];
}
echo "1) Go into your my.ini (or my.cnf if you are on Linux)<BR>";
echo "2) Add the following line under the [mysqld] section of the file<BR>";
echo "default-storage-engine=myisam<BR>";
echo "3) Restart the webserver<BR><BR>";
echo "4) Execute all these statements below against your sugar database.<BR><BR>";
foreach($tablearr as $key => $table)
{
echo "ALTER TABLE $table ENGINE = MYISAM<BR>";
}
?>
