MySQL database command example

Source: Internet
Author: User
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. Usedbname [LIKEwild]; showtables; showdatabases ;? Help; exitquit;

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 [LIKEwild]; showtables; showdatabases ;? /Help; exit/quit;

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.

 
 
  1. use [LIKE wild];
  2. show tables;
  3. show databases;
  4. ?/help;
  5. exit/quit;
  6. MySQLadmin version;
  7. MySQL MySQLadmin version;
  8. net start MySQL;
  9. MySQLadmin variables;
  10. MySQLadmin -h hostname --port=port_number variables;

By default, the port is 3306, And the socket name is MySQL database.

 
 
  1. MySQLadmin shutdown;
  2. MySQLadmin reload;
  3. MySQLadmin –help;
  4. MySQLadmin -u root -p shutdown;

If the-p option is omitted, MySQL considers that you do not need a password and do not prompt

 
 
  1. shell>MySQL –h MySQL.domain.net –u tom -p;
  2. CREATE DATABASE db_name;
  3. DROP DATABASE [IF EXISTS] db_name;
  4. SHOW/ DESCRIBE;
  5. source E:\Tomcat\webapps\2richshop1.1\doc\sql.txt;
  6. GRANT privileges (columns) ON what TO user IDENTIFIED BY "password" WITH GRANT OPTION

Modify the root user password:

 
 
  1. MySQL> UPDATE user SET password=PASSWORD("new password") WHERE user='hunte';
  2. MySQL> FLUSH PRIVILEGES;
  3. 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 as its existing value does not cause the TIMESTAMP column to be updated, because if you set a column as its current value, mySQL Databases ignore changes for efficiency .)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.