MySQL实用程序-〜/.my.cnf选项文件 [英] MySQL Utilities - ~/.my.cnf option file

查看:71
本文介绍了MySQL实用程序-〜/.my.cnf选项文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用mysql实用工具mysqldiff和mysqldbcompare中的2种,并希望避免在命令行上输入密码

I am trying to use 2 of the mysql utilities, mysqldiff and mysqldbcompare and want to avoid putting my password on the command line

是否可以使用选项文件为数据库连接指定密码,以防止我必须指定密码?

Is it possible to use an option file to specify the password for my DB connection to prevent me having to specify the password?

这是我目前拥有的命令...

This is the sort of command that I currently have...

/usr/share/mysql-workbench/python/mysqldiff --server1=root@localhost --server2=root@localhost --difftype=sql db1:db2

我在〜/.my.cnf也有一个文件,该文件具有"600"权限,并包含以下内容.

I also have a file at ~/.my.cnf that has "600" permissions and contains the following..

[client]
user=root
password=mypassword

当我通过命令行连接到MySQL时,它将在我的选项文件中获取详细信息,但mysql实用程序却没有:-/

When I connect via the command line to MySQL it picks up the details in my option file but the mysql utilities don't :-/

推荐答案

尝试一下-

[client]
user=root
password="pass"

[mysql]
user=root
password="pass"

[mysqldump]
user=root
password="pass"

[mysqldiff]
user=root
password="pass"

.my.cnf的位置:~/.my.cnf

Location for .my.cnf: ~/.my.cnf

请参考标题为使用选项文件的手册页

这篇关于MySQL实用程序-〜/.my.cnf选项文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆