docs: def ConfigureMySQLDatastore(config):
    """Prompts the user for configuration details for a MySQL datastore."""
    print("GRR will use MySQL as its database backend. Enter connection details:")
    datastore_init_complete = False
    db_options = {}
    while not datastore_init_complete:
      db_options["Datastore.implementation"] = "MySQLAdvancedDataStore"
      db_options["Mysql.host"] = RetryQuestion("MySQL Host", "^[\\.A-Za-z0-9-]+$",
                                               config["Mysql.host"])
      db_options["Mysql.port"] = int(
          RetryQuestion("MySQL Port (0 for local socket)", "^[0-9]+$",
                        config["Mysql.port"]))
      db_options["Mysql.database_name"] = RetryQuestion(
          "MySQL Database", "^[A-Za-z0-9-]+$", config["Mysql.database_name"])
      db_options["Mysql.database_username"] = RetryQuestion(
          "MySQL Username", "[A-Za-z0-9-@]+$", config["Mysql.database_username"])
      # TODO(hanuszczak): Incorrect type specification for `getpass`.
      # pytype: disable=wrong-arg-types
      db_options["Mysql.database_password"] = getpass.getpass(
          prompt="Please enter password for database user %s: " %
          db_options["Mysql.database_username"])
      # pytype: enable=wrong-arg-types
  
      use_ssl = RetryBoolQuestion("Configure SSL connections for MySQL?", False)
      if use_ssl:
        db_options["Mysql.client_key_path"] = RetryQuestion(
            "Path to the client private key file",
            default_val=config["Mysql.client_key_path"])
        db_options["Mysql.client_cert_path"] = RetryQuestion(
            "Path to the client certificate file",
            default_val=config["Mysql.client_cert_path"])
        db_options["Mysql.ca_cert_path"] = RetryQuestion(
            "Path to the CA certificate file",
            default_val=config["Mysql.ca_cert_path"])
  
      if CheckMySQLConnection(db_options):
        print("Successfully connected to MySQL with the provided details.")
        datastore_init_complete = True
      else:
        print("Error: Could not connect to MySQL with the provided details.")
        should_retry = RetryBoolQuestion(
            "Re-enter MySQL details? Answering 'no' will abort config "
            "initialization: ", True)
        if should_retry:
          db_options.clear()
        else:
          raise ConfigInitError()
  
    for option, value in iteritems(db_options):
      config.Set(option, value)