Increase memory usage for InnoDB MySQL database to improve p_MySQL
If your MySQL database tables still run on the MyISAM engine (formerly the default), you may want to consider switching to the InnoDB engine instead, for better reliability and scalability. To update a table from MyISAM to InnoDB you can run this SQL:ALTER TABLE table_name ENGINE = InnoDB; Once you’ve switched all your tables to InnoDB, you can adjust some memory usage settings. Update MySQL memory usage settings for InnoDB Firstly, check the current settings for SHOW VARIABLES; Look for I had 2GB of server memory to play with, so I chose a moderate 1GB to allocate to the On Linux Ubuntu , add a new sudo nano /etc/mysql/conf.d/innodb.cnf The file name must end in .cnf , but call it whatever you like, so long as it’s not clashing with another file name. Inside of this file, we add our new memory allocation: [mysqld]innodb_buffer_pool_size = 1024Mkey_buffer_size = 8M I’ve also added a new Finish off by restarting MySQL so that the changes can be applied: sudo service mysql restart If you check the MySQL variables once more: SHOW VARIABLES; You’ll hopefully now have some new and importantly increased memory values for innodb_buffer_pool_size and key_buffer_size
You’ve successfully optimised your MySQL database a bit more! |
- 上一篇:忘记Mysql密码后_MySQL
- 下一篇:阿里巴巴数据库连接池