• GoDaddy Community
  • VPS & Dedicated Servers
  • VPS & Dedicated Servers

    cancel
    Showing results for 
    Show  only  | Search instead for 
    Did you mean: 

    my.cnf file configuration in VPS

    Hi.

    I'd like to configure my.cnf file in order to get the well optimized values 

    I am using VPS with 4GB of RAM, 120GB of disk storage

    And Server version: 5.7.27 MySQL Community Server (GPL)

    By the way, I've followed this rule, but mysql server doesn't restart

    [mysqld]
     ## After edit config you have to remove log files and restart mysql server
     ## because after changing innodb-log-file-size you should recreate ib_logfiles
     ## Stop MySQL server
     ## rm /data/dir/ib_logfile*
     ## Run MySQL server
      
     ##Table open cache under MacOS and MySQL 5.6 should be 250.
     ##Otherwise you will get error MySQL server has gone away
     ##table-open-cache = 250
     table-open-cache = 4096
      
     ## Cache
     table-definition-cache = 4096
     thread-cache-size = 256
     query-cache-size = 64M
     query-cache-type = 1
      
     ## Per-thread Buffers
     sort-buffer-size = 16M
      
     ## Temp Tables
     max-heap-table-size = 512M
     tmp-table-size = 512M
      
     ## Networking
     interactive-timeout = 3600
     max-connections = 400
     max-connect-errors = 1000000
     max-allowed-packet = 512M
     skip-name-resolve
     skip-secure-auth
     wait-timeout = 28800
     ## MyISAM
     key-buffer-size = 256M
     #myisam-recover = FORCE,BACKUP
     myisam-sort-buffer-size = 128M
      
     ## InnoDB
     innodb-buffer-pool-size = 2G
     innodb-log-file-size = 256M
     innodb-thread-concurrency = 18
     innodb_flush_log_at_trx_commit = 2
     ##Fastest
     ##innodb_flush_log_at_trx_commit = 0

     

    What was wrong with me?

    And is there any optimized my.cnf sample file for VPS?