Avoid placing password on command line with MySQL Utilities?


First you need to reach the location of “my.cnf” with the help of below query for MySQL Utilities. The query is as follows −

mysql> select @@datadir;

The following is the output that display where “my.conf” is −

+---------------------------------------------+
| @@datadir                                   |
+---------------------------------------------+
| C:\ProgramData\MySQL\MySQL Server 8.0\Data\ |
+---------------------------------------------+
1 row in set (0.00 sec)

Follow the above path in order to open the “my.cnf” file. The snapshot of “my.cnf” location is as follows −

Now you can put the below MySQL Utilities in my.cnf which is as follows −

[client]
user = root
password = "yourPassword"

[mysql]
user = root
password = "yourPassword"

[mysqldiff]
user = root
password = "yourPassword"

[mysqldump]
user = root
password = "yourPassword"

Updated on: 29-Jun-2020

126 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements