MySQL database was set up with Localhost:3307. I am trying to use mysqldump command to back up all the data from my coworker. I wrote the command line like this: mysqldump -u root -h 3307 -p database > "path_to_dumpfile\database.sql". then, I was prompted to enter the password (which is not asked anymore when I open the workbench). The problem is that, I get the following error message: "mysqldump: got error:2005: unknown mysql server host '3307' <2> when trying to connect" Is there something that I did wrong? or a step that I did not follow?
Thanks for your help.
Try adding --port=port_num
to your command line instead of -h
(or -P port_num
if the former doesn't work) like so:
mysqldump -u root --port=3307 -p database > ..\path_to_dumpfile\database.sql
I'd recommend you take a look at the MySQL manual to learn of other possible arguments for the mysqldump
command, link as follows.
Source: https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html
I had the same problem, also using the --port parameter, and I solved using this suggestion from a serverfault answer:
When localhost parameter given, MySQL uses sockets. Use 127.0.0.1 instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With