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.connector 禁用查询缓存 2022-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- 是否可以执行按位分组功能? 2021-01-01
- 无法解决整理冲突 2021-01-01
- 在 SQL 中连接多个表 2021-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
