code: def db_exists(name, **connection_args):
      '''
      Checks if a database exists on the MySQL server.
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' mysql.db_exists 'dbname'
      '''
      dbc = _connect(**connection_args)
      if dbc is None:
          return False
      cur = dbc.cursor()
      # Warn: here db identifier is not backtyped but should be
      #  escaped as a string value. Note also that LIKE special characters
      # '_' and '%' should also be escaped.
      args = {"dbname": name}
      qry = "SHOW DATABASES LIKE %(dbname)s;"
      try:
          _execute(cur, qry, args)
      except MySQLdb.OperationalError as exc:
          err = 'MySQL Error {0}: {1}'.format(*exc.args)
          __context__['mysql.error'] = err
          log.error(err)
          return False
      cur.fetchall()
      return cur.rowcount == f db_exists(name, **connection_args):
      '''
      Checks if a database exists on the MySQL server.
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' mysql.db_exists 'dbname'
      '''
      dbc = _connect(**connection_args)
      if dbc is None:
          return False
      cur = dbc.cursor()
      # Warn: here db identifier is not backtyped but should be
      #  escaped as a string value. Note also that LIKE special characters
      # '_' and '%' should also be escaped.
      args = {"dbname": name}
      qry = "SHOW DATABASES LIKE %(dbname)s;"
      try:
          _execute(cur, qry, args)
      except MySQLdb.OperationalError as exc:
          err = 'MySQL Error {0}: {1}'.format(*exc.args)
          __context__['mysql.error'] = err
          log.error(err)
          return False
      cur.fetchall()
      return cur.rowcount == 1
docs: Checks if a database exists on the MySQL server.
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' mysql.db_exists 'dbname'