MySQL Monitor Program Options
The monitor program can take several parameters; the ones you’ll need most frequently are:
hostThe host the server is running on; you can leave this out if the server is running on the same host as the client (
localhost).userThe username to use when connecting to the MySQL server. This bears no relation to the username the server is running under, or to your Linux or Mac OS X username. If you don’t provide a username with this option, the monitor uses a default value; this default username is your machine account name on a Linux or Mac OS X system, and
ODBCon a Windows system.passwordThe password of this user. If you don’t provide the
passwordparameter, no password is supplied to the server. This is fine if there is no password stored for that user, but if the user does have a password, the connection will fail:$mysql --user=the_usernameERROR 1045 (28000): Access denied for user 'the_username'@'localhost' (using password: NO)If you include the
passwordoption but don’t specify a password, the client will prompt you for a password after you press the Enter key. If the user has no password, pressing the Enter key will work; otherwise, the connection will fail again:$mysql --user=the_username--passwordEnter password:ERROR 1045 (28000): Access denied for user 'the_username'@'localhost' (using password: NO)If you provide an incorrect password, or you don’t have permission to access a specified database, MySQL will note this in the error message: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access