[chef] Can't set encoding on MySQL database


Chronological Thread 
  • From: Kevin Harvey < >
  • To:
  • Subject: [chef] Can't set encoding on MySQL database
  • Date: Mon, 21 Nov 2011 08:33:05 -0500

Hello all,

I've got a project I'm working on that's based on OpsCode's "Django Quickstart" Django CMS tutorial. My project needs 'utf8' encoding for it's MySQL database. The quickstart's databag, django_cms.json, appears to be configured for utf8:

"databases": {
  "_default": {
    "encoding": "utf8",
    "username": "django",
    "adapter": "mysql",
    "port": "3306",
    "database": "django_production",
    "password": "awesome_password"
}

However, this doesn't seem to get picked up, as after the server is created I try this:

ssh 
 
 ">
 
mysql -u root -p
mysql> use django_production;
mysql> SHOW VARIABLES LIKE "character\_set\_database";
+------------------------+--------+
| Variable_name          | Value  |
+------------------------+--------+
| character_set_database | latin1 |
+------------------------+--------+
1 row in set (0.00 sec)

I took a look at cookbooks/database/master.rb, and edited as such to try to get the encoding added in, starting at line 84:

...
    mysql_database "create #{db['database']}" do
      host "localhost"
      username "root"
      password root_pw
      database db['database']
      encoding db['encoding']     # I added this line
      action [:create_db]
    end
...

Still nothing. I can SSH into the server and recreate the database as a workaround, but would love to have this set up properly when I first create the instance. Thanks in advance.

--
Kevin Harvey
Web Developer
615-686-8238
" target="_blank">




Archive powered by MHonArc 2.6.16.

§