When I'm executing mysqldump command from localhost or from remote host, it's not prompting me for password. I want the password prompt even though I'm running it from remote or from local. On my server there is no ~/.my.cnf present. Also I have Ubuntu server. I'm running mariadb. Also I would like to know how mysqldump command pick up a password everytime ?
3 Answers
If you want to enter a password manually each time you invo mysqldump you should use the -p option:
-p, --password[=name]
Password to use when connecting to server. If password is
not given it's solicited on the tty.
If you do not specify the password in the commandline, it will ask you to enter one.
From mariadb website, you can see:
Options
mysqldump supports the following options, which can be specified on the
command line or in the [mysqldump] and [client] option file groups. Default
options are read from the following files in the given order:
1. /etc/my.cnf
2. /etc/mysql/my.cnf
3. /usr/etc/my.cnf
4. ~/.my.cnf
mysqldump also supports the options for processing option files
So you should check that no password option for mysqldump is specified in all these files.
You should check that you have specified a password for the root@localhost user in MariaDB users table.