开发者

how to make faster my localhost Wamp Mysql?

开发者 https://www.devze.com 2023-03-18 12:21 出处:网络
I\'m running Drupal 7 on my Wamp localhost. On file "my.ini" I have: [wampmysqld] port= 3306 socket= /tmp/mysql.sock

I'm running Drupal 7 on my Wamp localhost.

  • On file "my.ini" I have:

[wampmysqld]

port        = 3306
socket      = /tmp/mysql.sock
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
basedir=c:/wamp/bin/mysql/mysql5.5.8
log-error=c:/wamp/logs/mysql.log
开发者_运维百科datadir=c:/wamp/bin/mysql/mysql5.5.8/data
log = c:/wamp/logs/mysql_query_log.log

What should I change to make it faster?


Having the same problem I found this:

http://drupal.org/node/551796

The sugestion is to move from wamp to Uniform Server:

http://www.uniformserver.com/

Because wamp and xamp just not cooperate correctly with Drupal and Windows.

After many attemps for boosting up I create a VM with Centos + Apache + PHP and now all runs smooth. But you will need more RAM (4Gb at least for Windows+VM+VM enviroment). On the other hand you can work better because you simulate the hosting provider enviroment, and you get less changes to setting files and compatibility for php and apache modules and settings.

EDIT: Another hint to make the db “faster” for local dev is to convert it to MyISAM from InnoDB. WARNING: Do this only for your local WAMP/XAMP dev environment!

<?php
/**
 * Convert all of the tables in the database to MyISAM.
 */
$mysqli = new mysqli("localhost", "<user>", "<pass>", "<db>");
// Check connection
if ($mysqli->connect_errno) {
  print("Connect failed: " . $mysqli->connect_error);
  exit();
}
// Get the results
if ($result = $mysqli->query("SHOW TABLES")) {
  print("Number of tables: " . $result->num_rows . "<br /><br />");
  // For each table, convert to MyISAM.
  while ($row = $result->fetch_row()) {
    $table_name = $row[0];
    $mysqli->query("ALTER TABLE " . $table_name . " ENGINE=MyISAM");
    print($table_name . " converted to MyISAM<br />");
  }
  // Free result set
  $result->close();
}
$mysqli->close();

Save the code to a file, and run it from your browser. (The code isn’t mine, but I can’t remember the original post. If you find it edit the post and add him)

0

精彩评论

暂无评论...
验证码 换一张
取 消