Jump to content

8.优化MariaDB数据库


Recommended Posts

--------------------------
优化MariaDB数据库
--------------------------

修改以下数值
vi /etc/my.cnf


有两个max_allowed_packet,都修改吧,修改为
max_allowed_packet = 1024M

 

这里参考宝塔面板的优化:内存2GB

key_buffer_size = 256M

table_open_cache = 192

sort_buffer_size = 768K

read_buffer_size = 768K

read_rnd_buffer_size = 512K

thread_cache_size = 96

query_cache_size = 128M

tmp_table_size = 384M

max_connections = 200

innodb_buffer_pool_size = 384M

innodb_log_buffer_size = 16M


保存并离开
:wq


重新启动数据库
lnmp mariadb restart


或者重启CentOS系统
sudo reboot
 

Edited by Jack
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...