下面来给各位介绍一下关于linux中mydumper需要输入明文密码解决方案,希望能帮助到各位同学.
在使用mydumper时,需要再命令行中输入用户名和密码,这会记录到history中,这样的话,就是相对不安全.
[root@liufofu backup]# mydumper -h localhost -u root -p tiger -c -o ./liufofu/ -B liufofu
查了下官方提供的解决方案有2种:
1、在homedir中新建一个.my.cfg,输入你的用户和密码
2、打上相应的补丁
具体可以参考官方的回复:
- 1.Use~/.my.cfgwithyourloginandpasswordtoauthenticate.Itwillbothnotsavepasswordinbashhistoryandhidepasswordifpslist,butyou’llhavetokeepplaintextpasswordinyourhomedir.
- 2.Trythispatch
- commit056fa3edc2a3880d35986d6f123430fde5fe292a
- Author:DmitryIlyin<emailaddresshidden>
- Date:SatOct2702:10:402012+0400
- Addcmdlinemaskformydumper
- diff–gita/mydumper.cb/mydumper.c
- index9c37d39..39edff1100644
- —a/mydumper.c
- +++b/mydumper.c
- @@-367,6+367,15@@intmain(intargc,char*argv[])
- init_mutex=g_mutex_new();
- +//calculatecmdlen
- +intcmdlen=0;
- +intargn=0;
- +
- +for(argn=0;argn<argc;++argn){
- +cmdlen+=(int)strlen(argv[argn]);
- +}
- +cmdlen=cmdlen+argc–1;
- +
- context=g_option_context_new(“multi-threadedMySQLdumping”);
- GOptionGroup*main_group=g_option_group_new(“main”,“MainOptions”,“MainOptions”,NULL,NULL);
- g_option_group_add_entries(main_group,entries);
- @@-377,6+386,11@@intmain(intargc,char*argv[])
- exit(EXIT_FAILURE);
- }
- g_option_context_free(context);
- +
- +//erasecmdline
- +memset(argv[0],’\0′,cmdlen);
- +//setnewcmdline
- +sprintf(argv[0],”mydumper:dumpingdatabase‘%s’”,db);
- if(program_version){
- g_print(“mydumper%s,builtagainstMySQL%s\n”,VERSION,MYSQL_SERVER_VERSION);
- ——-
- andthisformyloader
- ——-
- commitf8f9850045a317b927903482317ee32ecce47eea
- Author:DmitryIlyin<emailaddresshidden>
- Date:SatOct2702:24:332012+0400
- Addcmdlinemaskformyloader
- diff–gita/myloader.cb/myloader.c
- index7697e97..a38b4fd100644
- —a/myloader.c
- +++b/myloader.c
- @@-93,6+93,15@@intmain(intargc,char*argv[]){
- init_mutex=g_mutex_new();
- +//calculatecmdlen
- +intcmdlen=0;
- +intargn=0;
- +
- +for(argn=0;argn<argc;++argn){
- +cmdlen+=(int)strlen(argv[argn]);
- +}
- +cmdlen=cmdlen+argc–1;
- +
- context=g_option_context_new(“multi-threadedMySQLloader”);
- GOptionGroup*main_group=g_option_group_new(“main”,“MainOptions”,“MainOptions”,NULL,NULL);
- g_option_group_add_entries(main_group,entries);
- @@-104,6+113,11@@intmain(intargc,char*argv[]){
- }
- g_option_context_free(context);
- +//erasecmdline
- +memset(argv[0],’\0′,cmdlen);
- +//setnewcmdline
- +sprintf(argv[0],”myloader:loadingfromdirectory‘%s’”,directory);
- +--phpfensi.com
- if(program_version){
- g_print(“myloader%s,builtagainstMySQL%s\n”,VERSION,MYSQL_SERVER_VERSION);
- exit(EXIT_SUCCESS);
- —-
- Theyhidepasswordandotherargumentsfrompslist