Initial knowledge of MySQL (relational database)

Source: Internet
Author: User

First, the database change password

① executes the use MySQL first;

② Execute update mysql.user set Password=password (password to be modified) where user= ' root ';

MySQL User name: root

MySQL Password: modify it Yourself

MySQL server address: localhost

Two

MySQL Database (relational database)

1. Name: string: varchar; string length: Common 20-bit and 50-bit; allow null value;

2. Gender (Sex): bit, generally with Boolean data, common code 1 = male, 0 = female;

3. Age: Shaping int;

4. Address: string varchar, commonly used length is 50 bits;

5. Class (Class): string varchar,

6.text: No length limit, can save picture (convert picture to binary stream)

7. Primary key PK (Primary key): A data table must have a primary key, representing a piece of data, identified as the key;

8. Self-growth columns: to avoid duplication, or to find a suitable primary key, the data grows automatically whenever a row is inserted;

9. The table has been split until it can not be split, the more the table, the better;

10. Foreign key (foreign key): Must have two tables (main table, from table), master Table control from the table, select the main table from the table, the foreign key column in the main table must be the primary key;

11. FOREIGN Key relations: advantages (Security), shortcomings (slow productivity, if the establishment of external relations, the main table can not be deleted, modified); The company does not require the establishment of foreign key relations can not be used;

12. Rule: three main paradigms of database

① first paradigm: Guaranteeing the atomicity of each column (each column cannot continue to be demolished);

② Second paradigm: Ensure that each column of the data table is related to the primary key;

③ Third paradigm: Ensure that each column of the data table is directly related to the primary key (standard criteria for data tables);

The first paradigm of ④ must be satisfied;

13. Rule: ① splits the table until it cannot be split;

② table name plus prefix, name lowercase

③ if a column suitable for the primary key is not found, the self-growing column is used;

④ foreign key relationship can not add, see if there are special requirements;

Initial knowledge of MySQL (relational database)

Related Article

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.