connect mysql command line code example

Example 1: mysql cmd command to run

mysql.exe –uroot –p

Example 2: mysql login console

mysql -u USERNAME -p

Example 3: mysql connect command

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

Example 4: mysql cli connect with password

mysql --user=root --password=mypass

Example 5: connect to mysql localhost from the mysql shell

\connect root@localhost:3306

Example 6: connect mysql command line

mysql --host=localhost --port=myport --user=myname --password
mysql -h localhost -u myname -p --port=myport

Tags:

Misc Example