MySQL Utilities - ~/.my.cnf option file(MySQL 实用程序 - ~/.my.cnf 选项文件)
问题描述
我正在尝试使用 2 个 mysql 实用程序,mysqldiff 和 mysqldbcompare,并希望避免将密码放在命令行上
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 选项文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MySQL 实用程序 - ~/.my.cnf 选项文件


基础教程推荐
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- 带更新的 sqlite CTE 2022-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- 带有WHERE子句的LAG()函数 2022-01-01