Consequently, in order to access a database, a user must first log in.
The client program for a user to access MySQL is mysql.
To log in, a user named dbuser who wants access to
a database named productinfo can log in as follows:
mysql productinfo -u dbuser -p
The -u option specifies the name of the user as dbuser,
while the -p option indicates a password will be provided.
Note that one can specify -psecret to specify that the password
is secret in the command. However, supplying the password as
a part of the command is considered extremely unsafe. If no password
follows -p, the database client prompts for the password.
If everything goes well, you should see messages similar to the following:
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4866 to server version: 3.23.58-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>
To exit the database client, type the following:
quit;
Note that all commands must end with either ; or \g.
Copyright © 2008-05-09 by Tak Auyeung