Faircube Networks - Custom programming projects, internet consulting, web design, and various other multimedia and graphic design solutions.
 
Home arrow MySQL arrow Common MySQL Syntax
Common MySQL Syntax

If you want to find out which options will be taken from option files by mysql, use this command:

% mysql --print-defaults

You can also use the my_print_defaults utility, which takes as arguments the names of the option file groups that it should read. For example, mysql looks in both the [client] and [mysql] groups for options, so you can check which values it will take from option files like this:

% my_print_defaults client mysql

If you need to connect on occasion as the MySQL root user, specify the user and password options on the command line to override the option file values:

% mysql -p -u root

To issue a query at the mysql> prompt, type it in, add a semicolon ( ;) at the end to signify the end of the statement, and press Return. Examples

mysql> SELECT NOW( );

+---------------------+
| NOW( ) |
+---------------------+
| 2001-07-04 10:27:23 |
+---------------------+

mysql> SELECT

-> NOW( )\g
+---------------------+
| NOW( ) |
+---------------------+
| 2001-07-04 10:27:28 |
+---------------------+

The STATUS command (and its synonym, \s) also display the current database name, in additional to several other pieces of information:

mysql> \s

--------------
Connection id: 5589
Current database: mydb
Current user: myuser@localhost
Current pager: stdout
Using outfile: ''
Server version: 3.23.51-log
Protocol version: 10
Connection: Localhost via UNIX socket
Client characterset: latin1
Server characterset: latin1
UNIX socket: /tmp/mysql.sock
Uptime: 2 days 12 min 13 sec
Threads: 3 Questions: 35165 Slow queries: 0 Opens: 23 Flush tables: 1
Open tables: 12 Queries per second avg: 0.074
--------------

To cancel the statement completely, enter \c and type Return. This will return you to the mysql> prompt:

mysql> SELECT *
-> FROM limbs
-> ORDER BY\c
mysql>

 
 
Home | Services | Portfolio | Support | Prices | About Us | Privacy | Terms | Website Resources | Legal
Copyright © 1999-2007 Faircube Networks Inc. All Rights Reserved.