code: def create_database_mysql(database: str,
                            user: str,
                            password: str,
                            server: str = "localhost",
                            port: int = 3306,
                            charset: str = "utf8",
                            collate: str = "utf8_general_ci",
                            use_unicode: bool = True) -> bool:
      
      con = mysql.connect(
          host=server,
          port=port,
          user=user,
          passwd=password,
          charset=charset,
          use_unicode=use_unicode
      )
      sql = ("CREATE DATABASE IF NOT EXISTS {} DEFAULT CHARACTER SET {} "
             "DEFAULT COLLATE {}").format(
          database,
          charset,
          collate
      )
      cursor = con.cursor()
      debug_sql(sql)
      cursor.execute(sql)
      log.info("Created database {}", database)
      return True
docs: Connects via PyMySQL/MySQLdb and creates a database.