In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
1. Create an empty database create database the name of the database to be created; Note: create database aa;2, switch to the name of the database use to switch to; Note: use aa Create a data table in the database 3, create a data table in the database the name of the data table to be created by create table ("name" CHAR (character) NOT NULL, "age" INT (character) NOT NULL, "birth date" DATE NOT NULL, "class" CHAR (character) DEFAULT'do not write default content',) Note: create table C02 ("name" CHAR (24) NOT NULL, "age" INT (8) NOT NULL, "date of birth" DATE NOT NULL, "class" CHAR (10) DEFAULT 'C02,); 4. Insert multiple rows of data in the table: INSERT INTO table name (field name list) VALUES (values list), (values list)... ; example: insert into aa VALUES ('zhang','1','20'), (' li','2','30'); 5. Modify the contents in the table alter table table name change "date of birth" × × number "INT (field) NOT NULL Alter table C02 rename C02bot 6, delete database: DROP DATABASE database name; Note: drop database aa;7, commonly used field attribute constraints: non-empty constraint NOT NULL if a field is not allowed to be empty, you need to set a NOT NULL constraint. The default constraint DEFAULT assigns a field a default value. If the field is not assigned a value, the value is the default value. For example, if there are most boys in the student table, the gender default value can be set to "male" unique constraint UNIQUE KEY setting field is unique. Null is allowed, but only one null primary key constraint PRIMARY KEY sets this field as the primary key of the table, and it can be used as the only tag of the table record foreign key constraint FOREIGN KEY is used to establish a relationship between the two tables. You need to specify which field references the primary table to grow automatically AUTO_INCREMENT sets this field to self-increment field, default to increase 17 per entry, view data table list: SHOW table name; note: SHOW tables 8, view the definition fields in the table: DESCRIBE table name or DESC table name; Note: describe aa;desc aa;9, add new fields to existing fields: ALTER TABLE table name ADD field name data type attribute; 10, delete a field in the table: ALTER TABLE table name DROP field name; 11, insert data record in the data table, customize insert into 'library name. The table name in the library is'("name", "age", "date of birth") values ("Zhang San", "20 years"); note: insert into 'aa.c02' ("name", "age", "date of birth") values ("Zhang San", "20 years") 12. Types of backup: full backup, differential backup, incremental backup 13, backup mysql database mysqldump-uroot-pabc123 mysql > / opt/mysql.sql14, backup user, aa, bb these three databases mysqldump-uroot-pabc123-- databases user aa bb > / opt/uab.sql15, backup user in mysql database, information two data tables mysqldump-uroot-pabc123 mysql user information > / opt/mysqlum.sql16, the method of restoring the database. Method 1: enter the database and switch to the empty database source backup file name (absolute path) method 2: mysql-uroot-pabc123 < backup file name (absolute path) method 3: tar decompress backup software package method 4: mysqlbinlog-- no-defaults binary log files | mysql-uroot-pabc123mysqlbinlog-- no-defaults-- start-datetime='2019-01-15 1300 pabc123 -01-15 13 pabc123 30 pabc123 binary log file | mysql-log-log file
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.