int main(int argc,char *argv[])
{
  int reply;
  int rc;
  int hadpass, plugin_set= 0;

  MY_INIT(argv[0]);
  DBUG_ENTER("main");
  DBUG_PROCESS(argv[0]);
#ifdef __WIN__
  /* Convert command line parameters from UTF16LE to UTF8MB4. */
  my_win_translate_command_line_args(&my_charset_utf8mb4_bin, &argc, &argv);
#endif

  my_getopt_use_args_separator= TRUE;
  if (load_defaults("my", load_default_groups, &argc, &argv))
  {
    free_defaults(argv);
    my_end(0);
    free_resources();
    exit(1);
  }
  defaults_argv= argv;
  my_getopt_use_args_separator= FALSE;

  if ((rc= handle_options(&argc, &argv, my_connection_options,
                          my_arguments_get_one_option)))
  {
    free_resources();
    exit(rc);
  }

  if (mysql_init(&mysql) == NULL)
  {
    printf("\nFailed to initate MySQL connection");
    free_resources();
    exit(1);
  }
  init_connection_options(&mysql);

  hadpass= get_root_password();

  if (!validate_password_exists())
    plugin_set= set_plugin();
  else
  {
    fprintf(stdout, "validate_password plugin is installed on the server.\n"
	            "The subsequent steps will run with the existing "
		    "configuration\nof the plugin.\n");
    plugin_set= 1;
  }
  //Set the root password
  fprintf(stdout, "\n\nSetting the root password ensures that nobody can log "
                  "into\nthe MySQL root user without the proper "
		  "authorisation.\n");

  if (!hadpass)
  {
    fprintf(stdout, "Please set the root password here.\n");
    set_root_password(plugin_set);
  }
  else
  {
    fprintf(stdout, "You already have a root password set.\n\n");

    if (plugin_set == 1)
      estimate_password_strength(password);

    reply= get_response((const char *) "Change the root password? (Press y|Y "
	                               "for Yes, any other key for No) : ");

    if (reply == (int) 'y' || reply == (int) 'Y')
      set_root_password(plugin_set);
    else
      fprintf(stdout, "\n ... skipping.\n\n");
  }

  //Remove anonymous users
  remove_anonymous_users();

  //Disallow remote root login
  remove_remote_root();

  //Remove test database
  remove_test_database();

  //Reload privilege tables
  reload_privilege_tables();

  fprintf(stdout, "All done! If you've completed all of the above steps, your\n"
                  "MySQL installation should now be secure.\n");
  free_resources();
return 0;
}
int main(int argc,char *argv[])
{
  int reply;
  int rc;
  int hadpass, plugin_set= 0;

  MY_INIT(argv[0]);
  DBUG_ENTER("main");
  DBUG_PROCESS(argv[0]);
#ifdef __WIN__
   
  my_win_translate_command_line_args(&my_charset_utf8mb4_bin, &argc, &argv);
#endif

  my_getopt_use_args_separator= TRUE;
  if (load_defaults("my", load_default_groups, &argc, &argv))
  {
    free_defaults(argv);
    my_end(0);
    free_resources();
    exit(1);
  }
  defaults_argv= argv;
  my_getopt_use_args_separator= FALSE;

  if ((rc= handle_options(&argc, &argv, my_connection_options,
                          my_arguments_get_one_option)))
  {
    free_resources();
    exit(rc);
  }

  if (mysql_init(&mysql) == NULL)
  {
    printf("\nFailed to initate MySQL connection");
    free_resources();
    exit(1);
  }
  init_connection_options(&mysql);

  hadpass= get_root_password();

  if (!validate_password_exists())
    plugin_set= set_plugin();
  else
  {
    fprintf(stdout, "validate_password plugin is installed on the server.\n"
	            "The subsequent steps will run with the existing "
		    "configuration\nof the plugin.\n");
    plugin_set= 1;
  }
   
  fprintf(stdout, "\n\nSetting the root password ensures that nobody can log "
                  "into\nthe MySQL root user without the proper "
		  "authorisation.\n");

  if (!hadpass)
  {
    fprintf(stdout, "Please set the root password here.\n");
    set_root_password(plugin_set);
  }
  else
  {
    fprintf(stdout, "You already have a root password set.\n\n");

    if (plugin_set == 1)
      estimate_password_strength(password);

    reply= get_response((const char *) "Change the root password? (Press y|Y "
	                               "for Yes, any other key for No) : ");

    if (reply == (int) 'y' || reply == (int) 'Y')
      set_root_password(plugin_set);
    else
      fprintf(stdout, "\n ... skipping.\n\n");
  }

   
  remove_anonymous_users();

   
  remove_remote_root();

   
  remove_test_database();

   
  reload_privilege_tables();

  fprintf(stdout, "All done! If you've completed all of the above steps, your\n"
                  "MySQL installation should now be secure.\n");
  free_resources();
return 0;
}