HTTPBadResponse while setting up mysql database

I’ve been following this tutorial to set up the mysql database for a self hosted instance of OBS: https://openbuildservice.org/help/manuals/obs-admin-guide/obs.cha.installation_and_configuration.html#_mysql_setup

Everything works just fine up until I run: “sudo RAILS_ENV=“production” rake writeconfiguration”. At that point I get the following error: Net::HTTPBadResponse: wrong status line: “Y\x00\x00\x00”. I’m not quite sure how to deal with this. Does anybody have any suggestions as to what might be going wrong?