linux中mydumper需要输入明文密码解决方案
发布:smiling 来源: PHP粉丝网 添加日期:2014-10-10 15:00:57 浏览: 评论:0
下面来给各位介绍一下关于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.cfg with your login and password to authenticate. It will both not save password in bash history and hide password if ps list, but you’ll have to keep plaintext password in your homedir.
- 2. Try this patch
- commit 056fa3edc2a3880d35986d6f123430fde5fe292a
- Author: Dmitry Ilyin <email address hidden>
- Date: Sat Oct 27 02:10:40 2012 +0400
- Add cmdline mask for mydumper
- diff –git a/mydumper.c b/mydumper.c
- index 9c37d39..39edff1 100644
- — a/mydumper.c
- +++ b/mydumper.c
- @@ -367,6 +367,15 @@ int main(int argc, char *argv[])
- init_mutex = g_mutex_new();
- + //calculate cmdlen
- + int cmdlen = 0;
- + int argn = 0;
- +
- + for (argn = 0; argn < argc; ++argn) {
- + cmdlen += (int) strlen(argv[argn]);
- + }
- + cmdlen = cmdlen + argc – 1;
- +
- context = g_option_context_new(“multi-threaded MySQL dumping”);
- GOptionGroup *main_group= g_option_group_new(“main”, “Main Options”, “Main Options”, NULL, NULL);
- g_option_group_add_entries(main_group, entries);
- @@ -377,6 +386,11 @@ int main(int argc, char *argv[])
- exit (EXIT_FAILURE);
- }
- g_option_context_free(context);
- +
- + //erase cmdline
- + memset(argv[0],’\0′,cmdlen);
- + //set new cmdline
- + sprintf(argv[0],”mydumper: dumping database ‘%s’”,db);
- if (program_version) {
- g_print(“mydumper %s, built against MySQL %s\n”, VERSION, MYSQL_SERVER_VERSION);
- ——-
- and this for my loader
- ——-
- commit f8f9850045a317b927903482317ee32ecce47eea
- Author: Dmitry Ilyin <email address hidden>
- Date: Sat Oct 27 02:24:33 2012 +0400
- Add cmdline mask for myloader
- diff –git a/myloader.c b/myloader.c
- index 7697e97..a38b4fd 100644
- — a/myloader.c
- +++ b/myloader.c
- @@ -93,6 +93,15 @@ int main(int argc, char *argv[]) {
- init_mutex= g_mutex_new();
- + //calculate cmdlen
- + int cmdlen = 0;
- + int argn = 0;
- +
- + for (argn = 0; argn < argc; ++argn) {
- + cmdlen += (int) strlen(argv[argn]);
- + }
- + cmdlen = cmdlen + argc – 1;
- +
- context= g_option_context_new(“multi-threaded MySQL loader”);
- GOptionGroup *main_group= g_option_group_new(“main”, “Main Options”, “Main Options”, NULL, NULL);
- g_option_group_add_entries(main_group, entries);
- @@ -104,6 +113,11 @@ int main(int argc, char *argv[]) {
- }
- g_option_context_free(context);
- + //erase cmdline
- + memset(argv[0],’\0′,cmdlen);
- + //set new cmdline
- + sprintf(argv[0],”myloader: loading from directory ‘%s’”,directory);
- + --phpfensi.com
- if (program_version) {
- g_print(“myloader %s, built against MySQL %s\n”, VERSION, MYSQL_SERVER_VERSION);
- exit(EXIT_SUCCESS);
- —-
- They hide password and other arguments from ps list
Tags: mydumper linux明文密码
相关文章
- ·linux中mydumper出现libmysqlclient_16 not defined如何解决(2014-10-10)
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)