@@ -2955,49 +2955,6 @@ int init_common_variables()
2955
2955
return 1 ;
2956
2956
init_client_errs ();
2957
2957
2958
- /*
2959
- initiate key migration if any one of the migration specific
2960
- options are provided.
2961
- */
2962
- if (opt_keyring_migration_source ||
2963
- opt_keyring_migration_destination ||
2964
- migrate_connect_options)
2965
- {
2966
- Migrate_keyring mk;
2967
- my_getopt_skip_unknown= TRUE ;
2968
- if (mk.init (remaining_argc, remaining_argv,
2969
- opt_keyring_migration_source,
2970
- opt_keyring_migration_destination,
2971
- opt_keyring_migration_user,
2972
- opt_keyring_migration_host,
2973
- opt_keyring_migration_password,
2974
- opt_keyring_migration_socket,
2975
- opt_keyring_migration_port))
2976
- {
2977
- sql_print_error (ER_DEFAULT (ER_KEYRING_MIGRATION_STATUS),
2978
- " failed" );
2979
- log_error_dest= " stderr" ;
2980
- flush_error_log_messages ();
2981
- return 1 ;
2982
- }
2983
-
2984
- if (mk.execute ())
2985
- {
2986
- sql_print_error (ER_DEFAULT (ER_KEYRING_MIGRATION_STATUS),
2987
- " failed" );
2988
- log_error_dest= " stderr" ;
2989
- flush_error_log_messages ();
2990
- return 1 ;
2991
- }
2992
-
2993
- my_getopt_skip_unknown= 0 ;
2994
- sql_print_information (ER_DEFAULT (ER_KEYRING_MIGRATION_STATUS),
2995
- " sucessfull" );
2996
- log_error_dest= " stderr" ;
2997
- flush_error_log_messages ();
2998
- exit (MYSQLD_SUCCESS_EXIT);
2999
- }
3000
-
3001
2958
mysql_client_plugin_init ();
3002
2959
if (item_create_init ())
3003
2960
return 1 ;
@@ -4680,15 +4637,6 @@ int mysqld_main(int argc, char **argv)
4680
4637
srand (static_cast <uint>(time (NULL )));
4681
4638
#endif
4682
4639
4683
- /*
4684
- We have enough space for fiddling with the argv, continue
4685
- */
4686
- if (my_setwd (mysql_real_data_home,MYF (MY_WME)) && !opt_help)
4687
- {
4688
- sql_print_error (" failed to set datadir to %s" , mysql_real_data_home);
4689
- unireg_abort (MYSQLD_ABORT_EXIT); /* purecov: inspected */
4690
- }
4691
-
4692
4640
#ifndef _WIN32
4693
4641
if ((user_info= check_user (mysqld_user)))
4694
4642
{
@@ -4733,6 +4681,56 @@ int mysqld_main(int argc, char **argv)
4733
4681
}
4734
4682
#endif // !_WIN32
4735
4683
4684
+ /*
4685
+ initiate key migration if any one of the migration specific
4686
+ options are provided.
4687
+ */
4688
+ if (opt_keyring_migration_source ||
4689
+ opt_keyring_migration_destination ||
4690
+ migrate_connect_options)
4691
+ {
4692
+ Migrate_keyring mk;
4693
+ if (mk.init (remaining_argc, remaining_argv,
4694
+ opt_keyring_migration_source,
4695
+ opt_keyring_migration_destination,
4696
+ opt_keyring_migration_user,
4697
+ opt_keyring_migration_host,
4698
+ opt_keyring_migration_password,
4699
+ opt_keyring_migration_socket,
4700
+ opt_keyring_migration_port))
4701
+ {
4702
+ sql_print_error (ER_DEFAULT (ER_KEYRING_MIGRATION_STATUS),
4703
+ " failed" );
4704
+ log_error_dest= " stderr" ;
4705
+ flush_error_log_messages ();
4706
+ unireg_abort (MYSQLD_ABORT_EXIT);
4707
+ }
4708
+
4709
+ if (mk.execute ())
4710
+ {
4711
+ sql_print_error (ER_DEFAULT (ER_KEYRING_MIGRATION_STATUS),
4712
+ " failed" );
4713
+ log_error_dest= " stderr" ;
4714
+ flush_error_log_messages ();
4715
+ unireg_abort (MYSQLD_ABORT_EXIT);
4716
+ }
4717
+
4718
+ sql_print_information (ER_DEFAULT (ER_KEYRING_MIGRATION_STATUS),
4719
+ " successfull" );
4720
+ log_error_dest= " stderr" ;
4721
+ flush_error_log_messages ();
4722
+ unireg_abort (MYSQLD_SUCCESS_EXIT);
4723
+ }
4724
+
4725
+ /*
4726
+ We have enough space for fiddling with the argv, continue
4727
+ */
4728
+ if (my_setwd (mysql_real_data_home,MYF (MY_WME)) && !opt_help)
4729
+ {
4730
+ sql_print_error (" failed to set datadir to %s" , mysql_real_data_home);
4731
+ unireg_abort (MYSQLD_ABORT_EXIT); /* purecov: inspected */
4732
+ }
4733
+
4736
4734
// If the binlog is enabled, one needs to provide a server-id
4737
4735
if (opt_bin_log && !(server_id_supplied) )
4738
4736
{
0 commit comments