Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Add to MySQL Configuration on Travis CI When Not Sudo

I am trying to figure out how to change MySQL configuration before a Travis CI test run. We are using the "sudo:false" directive, I think to use containers...I'm not the best devops person.

But even when I set sudo to true, I can't restart MySQL after I try to add lines to "/etc/mysql/my.cnf".

So,

  - cat "some/directory/my.cnf" | sudo tee -a /etc/mysql/my.cnf
  - sudo /etc/init.d/mysql restart

gives me: "start: Job failed to start", but I don't even want to use sudo. For PHP config, I can do something like:

  - echo "apc.shm_size=256M" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini

but I can't see anything in my home folder about MySQL.

I also know about:

  - mysql -e "SET GLOBAL innodb_buffer_pool_size = 512M;"

but the things I want to set give me:

  ERROR 1238 (HY000) at line 1: Variable 'innodb_buffer_pool_size' is a read only variable

So, I'm at a loss on how to accomplish changing MySQL configuration on Travis CI, and every internet search and method I've tried has failed me.

like image 632
Alex Finnarn Avatar asked Nov 17 '16 17:11

Alex Finnarn


1 Answers

innodb_buffer_pool_size cannot be dynamically changed until MySQL 5.7.5. What version are you using?

Before that version, here are some options:

  • Modify /etc/my.cnf (or wherever it is located)
  • Assuming my.cnf has an 'include' at the end, then temporarily add a file to the directory mentioned. It needs 2 lines [mysqld] and innodb_buffer_pool_size=512M; then restart mysqld.
  • Add --innodb_buffer_pool_size=512M to the launching of mysqld.

Other "VARIABLES" may, or may not, be dynamically settable. Research each one separately.

like image 185
Rick James Avatar answered Oct 07 '22 00:10

Rick James