The mysqldump client utility performs logical backups, producing a set of SQL statements that can be executed to reproduce the original database object definitions and table data.
By default, the mysqldump
command uses the port 3306 to connect to the database. To use a different port, you can provide the --port
(or -P
) option followed by the port number you want to use. The --port
option specifies the TCP/IP port number to use when connecting to the MySQL server.
Note: when using -P
remember to use an uppercase P
, because the lowercase -p
refers to the password option.
Here’s the general syntax of using mysqldump
with a specific port:
mysqldump --port=PORT_NUMBER -u USERNAME -p DATABASE_NAME > dump.sql
Please replace the placeholders with the information:
PORT_NUMBER
: The specific port number you want to use (3306 or any other).USERNAME
: Your MySQL username.DATABASE_NAME
: The name of the database you wish to back up.dump.sql
: The file name where you want to store the database backup.
Once you run this command you will be asked to input your MySQL password. After providing the password the mysqldump
command will establish a connection to the MySQL server using the specified port. It will generate a backup of the designated database.
For a list of options, with mysqldump
refer to the official MySQL documentation.
Foto von André Carvalho auf Unsplash
Leave a Reply