Bug #74899 mysqldump should ignore prompt setting in ~/.my.cnf

Submitted: 17 Nov 2014 11:18 Modified: 17 Nov 2014 11:30
Reporter: Simon Mudd Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S3 (Non-critical)
Version:all versions up to 5.7.5 OS:Any
Assigned to: CPU Architecture:Any
Tags: mysqldump, prompt

[17 Nov 2014 11:18] Simon Mudd
Description:
mysqldump should ignore the prompt entry in a defaults file.

I use a defaults file to access my database server. This has entries to access the server including a setting to define the prompt that the mysql client uses.

mysqldump also uses this defaults file but complains about the prompt setting and I think that given I'm trying to use the same defaults file it would be good if it just ignored it and didn't complain.

How to repeat:
# silly example to dump a database and load it back into the same box.
[myuser@myhost ~]$ mysqldump -d old_db | mysql new_db
mysqldump: [ERROR] unknown variable 'prompt=\u@\h [\d]> '

My defaults file has the following:

[myuser@myhost ~]$ cat .my.cnf
[client]
user=myuser
prompt='\u@\h [\d]> '
socket=/path/to/some/mysql.sock
password=mysecretpassword

Suggested fix:
Please make mysqldump, when it parses a defaults file, just ignore the prompt setting.
It doesn't need to do anything with it and it won't affect how it behaves.
[17 Nov 2014 11:30] MySQL Verification Team
Hello Simon,

Thank you for the report.

Thanks,
Umesh
[17 Nov 2014 11:31] MySQL Verification Team
// 5.6.23

// conf
[root@cluster-repo mysql-advanced-5.6.23]# more ~root/.my.cnf
[client]
user=root
prompt='\u@\h [\d]> '
socket=/tmp/mysql.sock
password=

// with mysql CLI
[root@cluster-repo mysql-advanced-5.6.23]# bin/mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.23-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

root@localhost [(none)]> show grants;
+---------------------------------------------------------------------+
| Grants for root@localhost                                           |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION        |
+---------------------------------------------------------------------+
2 rows in set (0.00 sec)

root@localhost [(none)]> \q
Bye

// Wth mysqldump

[root@cluster-repo mysql-advanced-5.6.23]# bin/mysqldump
mysqldump: unknown variable 'prompt=\u@\h [\d]> '
[17 Nov 2014 11:36] MySQL Verification Team
// 5.7.6

[root@cluster-repo mysql-advanced-5.7.6]# bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.6-m16-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

root@localhost [(none)]> \q
Bye
[root@cluster-repo mysql-advanced-5.7.6]#
[root@cluster-repo mysql-advanced-5.7.6]# bin/mysqldump
mysqldump: [ERROR] unknown variable 'prompt=\u@\h [\d]> '
[17 Nov 2014 11:47] Shane Bester
that setting for prompt should be the [mysql] section instead of the [client] section ;)
[17 Nov 2014 11:54] MySQL Verification Team
Thank you Shane.

*prompt option should be in [mysql] group instead of [client] to avoid that issue. Could you please confirm this? 

Please also see, http://dev.mysql.com/doc/refman/5.6/en/mysql-command-options.html

Thanks,
Umesh
[18 Jan 2020 13:11] MySQL Verification Team
Bug #98278 marked as duplicate of this one

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.061 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.