The following articles mainly describe MySQL database commands. This article mainly uses the actual application code to introduce the actual operations of MySQL database commands. At the same time, this article also involves the actual application Syntax of SELECT statements, the following describes the relevant content.
- use <dbname> [LIKE wild];
- show tables;
- show databases;
- ?/help;
- exit/quit;
- MySQLadmin version;
- MySQL MySQLadmin version;
- net start MySQL;
- MySQLadmin variables;
- MySQLadmin -h hostname --port=port_number variables;
By default, the port is 3306, And the socket name is MySQL database.
- MySQLadmin shutdown;
- MySQLadmin reload;
- MySQLadmin –help;
- MySQLadmin -u root -p shutdown;
If the-p option is omitted, MySQL considers that you do not need a password and do not prompt
- shell>MySQL –h MySQL.domain.net –u tom -p;
- CREATE DATABASE db_name;
- DROP DATABASE [IF EXISTS] db_name;
- SHOW/ DESCRIBE;
- source E:\Tomcat\webapps\2richshop1.1\doc\sql.txt;
- GRANT privileges (columns) ON what TO user IDENTIFIED BY "password" WITH GRANT OPTION
-
Modify the root user password:
- MySQL> UPDATE user SET password=PASSWORD("new password") WHERE user='hunte';
- MySQL> FLUSH PRIVILEGES;
- MySQL> QUIT
The SELECT statement syntax is as follows:
SELECT selection_list
FROM table_list where to select a row
WHERE primary_constraint
How does group by grouping_columns GROUP results?
HAVING secondary_constraint must meet the second condition
Order by sorting_columns how to sort results
LIMIT on LIMIT count results
Note: All keywords used must be given exactly in the above Order. For example, a HAVING clause must be followed BY the group by clause and before the order by clause.
COUNT () function COUNT the number of non-NULL results
The TIMESTAMP column type is provided. The TIMESTAMP value can start from a certain time of 1970 until January 1, 2037. The precision is one second, and its value is displayed as a number. You can use it to automatically mark INSERT or UPDATE operations with the current date and time. If you have multiple TIMESTAMP columns, only the first one is automatically updated.
The first TIMESTAMP column is automatically updated under any of the following conditions:
The l column is not explicitly specified in an INSERT or load data infile statement.
L columns are not explicitly specified in an UPDATE statement and some other columns change values. Note that setting an UPDATE column to an existing value does not cause the TIMESTAMP column to be updated, because if you set a column to its current value, the MySQL database ignores the changes for efficiency .)