Code

Ticket #6517: mysql_client.patch

File mysql_client.patch, 776 bytes (added by tvrg, 6 years ago)

small patch to illustrate suggestion

  • db/backends/mysql/client.py

     
    99    host = settings.DATABASE_OPTIONS.get('host', settings.DATABASE_HOST) 
    1010    port = settings.DATABASE_OPTIONS.get('port', settings.DATABASE_PORT) 
    1111    defaults_file = settings.DATABASE_OPTIONS.get('read_default_file') 
     12    charset = settings.DATABASE_OPTIONS.get('charset', '') 
    1213    # Seems to be no good way to set sql_mode with CLI 
    1314     
    1415    if defaults_file: 
     
    2324        args += ["--port=%s" % port] 
    2425    if db: 
    2526        args += [db] 
     27    if charset: 
     28        args += ["--default-character-set=%s" % charset] 
    2629 
    2730    os.execvp('mysql', args)