To be able to connect and disconnect a MySQL server to query any data like this:
shell> mysql -h host -u user -p
Enter password: ********
.
.
.
mysql>
mysql>
mysql> quit
Bye
mysql | the program that is invoked |
-h host | host represent the host name where your MySQL server is running (if host is localhost, you can omit this option) |
-u user | user represent the user name of your MySQL account |
-p | to enter password of user at the "Enter password:" prompt. |
quit or \q | exit MySQL program (On Unix, you can also disconnect by pressing Control+D.) |
Example:
C:\>
C:\>mysql -h localhost -u root -p
Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.27 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
mysql>
mysql> quit
Bye
C:\>
Refer to: | MySQL Document as "refman5-5" |
| |
No comments:
Post a Comment