       if root
         await @get_root_pw esc defer pw
       else
-        pw = @password or mm.config.dbpw?.password
+        pw = @password or mm.config.secrets?.dbpw
         params.database = @cfg.database
       params.password = pw
       conn = mysql.createConnection params

      await c.query q, esc defer()
    await @get_conn { root : false }, esc defer c2
    await c2.query @_create_tables, esc defer()
    await @write_password esc defer()
    log.info "- created database"
    cb null
    


  #---------

  write_secrets : (cb) ->
    fn = path.join env.get().get_config_dir(), 'secrets.json'
    log.info "| writing password out to #{fn}"
    obj = mm.config.secrets or {}
    obj.dbpw = @password
    json = JSON.stringify obj, null, "    "
    await fs.writeFile fn, json, {mode : 0o640 }, defer err
    cb err
 
  #---------
