Base login
suggest changeTo access MySQL from the command line:
mysql --user=username --password=pwd --host=hostname test_db
This can be shortened to:
mysql -u username -ppassword -h hostname test_db
There must be no space between -p and the password. A space makes the client treat the next word as the database name and still prompt for a password. Omitting the password after -p makes the client prompt for it. Putting the password on the command line produces an “insecure” warning:
mysql -u username -p -h hostname test_db
For local connections --socket can be used to point to the socket file:
mysql --user=username --password=pwd --host=localhost --socket=/path/to/mysqld.sock test_db
Omitting the socket parameter will cause the client to attempt to attach to a server on the local machine. The server must be running to connect to it.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents