1. Write code to back up the MySQL database:1) under Linux, back up the MySQL database and execute the command under the shell:mysqldump-uroot-p123456-a >db_bak.sqlImport Osimport Datetimeclass bakdb (object): Def __init__ (self, IP, username,
ObjectiveThe database storage engine is the database's underlying software organization, and the Database management system (DBMS) uses the data engine to create, query, update, and delete data. Different storage engines provide different storage
Say in front
Toss this for a while, now do the next record
Installation dependency (operation only on Master side)yum install mysql-python or pip install mysql-pythonCreate the corresponding table structure in the master side local
First, the system database
INFORMATION_SCHEMA: Virtual library, do not occupy disk space, storage is the database startup parameters, such as user table information, column information, permission information, character information, etc.
1.SQL not NULL constraintThe NOT NULL constraint enforces that the column does not accept null values.A NOT NULL constraint forces a field to always contain a value. This means that if you do not add a value to the field, you cannot insert a new
Tables in MySQLA table is a structured file that can be used to store data of a particular type. A record in the table has a corresponding caption, which is called a table field.Various operations for tables in MySQL are created
12345
Failure phenomena:Enter the slave server and run:MySQL> show Slave status\g ... . Relay_log_file:localhost-Relay-bin. 000535 21795072 relay_master_log_file:localhost-bin.
Introduction to a storage engineThe storage engine is a table type, and MySQL has different processing mechanisms depending on the table typeHttp://www.cnblogs.com/guoyunlong666/p/8491702.htmlTwo table IntroductionTable is equivalent to a file, a
Common functionsarithmetic FunctionsI believe you can understand, so the above is not too much explanationAnd then there's the between and: the one that's missing from the front.Indicates whether 10 is between 0 and 20 and returns 0 if it returns
Since the landing was already very popular in the way of landing, the relevance should also be considered in database design. General storage open_id, icons, nicknames is enough. The nickname should be special attention, otherwise it might be like
1. Insert Data Modea> INSERT into student (ID, name, age) VALUES (1, ' Zhangsan ', 3);--The string type should be enclosed in double quotes or single quotes, otherwise the error b> INSERT into student values (1, ' Zhangsan ', 3); --Omit
There are times when we manipulate database tables, but when we insert data into a table, we encounter data that already exists in the table for that ID or data without that ID, insert it directly when there is no data for that ID, and then update
First, connect to the remote database:1. Display passwordFor example: MySQL connection remote Database (192.168.2.115), port "3306", username "root", password "root"C:/>-192.168. 2.115 - 3306 - -Proot (note first p capitalization)2. Hidden
SELECT * from ecs_goods WHERE goods_id = 1;SELECT goods_id, goods_name from ecs_goods WHERE goods_id = 1;SELECT goods_id,cat_id,goods_name from Ecs_goods WHERE cat_id! = 3;SELECT goods_id,cat_id,goods_name from Ecs_goods WHERE cat_id <> 3;SELECT
MySQL connection number is not enough (too many error connections):To view the current number of connections:NETSTAT-ANP | grep 3306 | Wc-lView the maximum number of connections for MySQL configuration (default is 151):
Show variables like '
Yesterday encountered a more bizarre problem, when using MySQL paging query data,Some of the data is clearly in the database, but it is not found, some data will insteadRecur.This involves a problem with MySQL itself.The specific phenomenon is
BackgroundBecause the blogger is responsible for testing the project requires a large database throughput, recently upgraded, updated a database middleware-mycat. Query some information, understand that this is Ali's an open source project, based on
In MySQL, after a transaction commits, it is necessary to write undo, write Redo, write binlog, write data files, and so on. In this process, crash may occur at a certain step, which may result in inconsistent master-slave data. To avoid this
Use mysqldump to back up and restore the database,
Database storage engine: InnoDB
Enable binlong1. Restore the database accidentally deleted to the latest status
1. Back up the database
mysqldump -A -F -uroot -p --master-data=2 --single-transaction
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