Connecting to MySQL Server

Voiced by Amazon Polly

In this post, I will explain how to establish connections to the MySQL server, for clients such as MySQL or MySQLdump.

To specify the hostname and user name explicitly, as well as a password, supply appropriate options on the command line.

mysql --host=localhost --user=myname --password mydbname
mysql -h localhost -u myname -p mydbname

Do not insert the password into the command as it will be stored in your cli history. MySQL will prompt you for this after a connection is made. The password is not displayed as you enter it.

This command connects to the server running on using the default port number (3306):


In some instances you may not be running the MySQL Server on the default port 3306, if you need to specify another port you would use this command:

mysql --port=13306

Similar Posts

One Comment

Leave a Reply