Integrity constraints are imposed on fields to meet the expected results of the field. For example, a field contains a default value and cannot be null.
Directly speaking, if the inserted data does not meet the restrictions, the database management
I believe that you have had reinstallation experience when using MySQL. If you reinstall MySQL, it is basically the last step. Unless you reinstall the operating system, the reason is that the registry in the system is not deleted. The following is
When creating a table, we will inevitably consider the disadvantages of weeks. Therefore, we need to use the alter table statement to modify the table later.
Modify Table Name
Copy codeThe Code is as follows: mysql> alter table student rename
MySQL we have installed is a database management tool. What is really valuable is that data in a relational database exists in the form of tables, the aggregation of N tables becomes a database. Now let's take a look at the basic operations of the
In order to install the mysql environment for testing, it was found that mysql occupied a large amount of virtual memory after the installation, which could reach more than 8 hundred megabytes. I searched for it online and got some tips from my. ini.
A few days ago, I wrote a summary of Mysql cross-Table update. Today, let's take a look at cross-Table deletion.
After Mysql4.0, mysql began to support cross-Table delete.
Mysql can delete multiple table records in an SQL statement at the same time,
In Navicat for MySQL, PostgreSQL and Oracle
The error occurs because the mysql account does not have sufficient permissions to connect to the remote mysql server.
After mysql is installed, only "localhost" connections are allowed by default.
Create test table
Copy codeThe Code is as follows: create table t
(
V VARCHAR (100) NOT NULL
) Engine innodb default charset = utf8;
Create a stored procedure for timer calls
DELIMITER $
Drop procedure if exists e_test $
Create procedure e_test
Query data for the current week
SELECT name, submittime FROM enterprise where yearweek (date_format (submittime, '% Y-% m-% D') = YEARWEEK (now ());
Query last week's dataSELECT name, submittime FROM enterprise where yearweek (date_format
There are three solutions to this problem:
1. Increase the value of the wait_timeout attribute of MySQL.
Modify the/etc/mysql/my. cnf file and set it in [mysqld:
# Set a connection to wait 8 hours in idle status.Wait_timeout = 86400Related
MYSQL date comparison
TO_DAYS (NOW ()-TO_DAYS (date_col) Our date_col must be in the date and time format, not the timestamp,
Mysql> SELECT FROM_UNIXTIME (875996580 );-> '2017-10-04 22:23:00'
Day (FROM_UNIXTIME (1277709862) returns the number
Introduction
Xtrabackup is a mysql database backup tool provided by percona. According to the official introduction, Xtrabackup is the only open-source tool in the world that can perform hot backup for innodb and xtradb databases. Features:
(1) The
Assume that the Status field of a data table is of the varchar type and has the following values: NULL, pending, pending refund, refund, and cancel.
We know the order whose query status is cancel. The SQL statement can be written as follows: SELECT
Change the Data Type of a column
[SQL]
Alter table visitor MODIFY nam VARCHAR (30 );
Append a new column
[SQL]
Alter table visitor ADD age INT;
Alter table visitor ADD age int first;
Alter table visitor ADD age int after nam;
Change column
1Replicate_do_db and replicate_ignore_db do not appear at the same time. It is prone to confusion. It is meaningless.
Replicate_Do_DB: db1
Replicate_Ignore_DB: db2
Statement mode:
Use the use statement
Use db1; insert into tb1 values (1 );
Use db2;
Mysql stored procedures are supported from version 5. Therefore, stored procedures are generally used. Today, I will share my understanding about the Mysql stored procedure.
Some simple calls and syntax rules are not described here. There are many
If you back up your data, ignore it.If the data is too big, use the database client software to directly import the data into the memory, or execute SQL directly.1. Specify the file path.2. fields are separated by commas, and data rows are separated
SQL code
Copy codeThe Code is as follows :/*
Navicat MySQL Data Transfer
Source Server: localSource Server Version: 50022Source Host: localhost: 3306Source Database: test
Target Server Type: MYSQLTarget Server versions: 50022File Encoding:
ERROR 1130 (HY000): Host 'localhost' is not allowed to connect to this MySQL server www.2cto.com
Cause:Mysql only has one root user. After changing the root password, select MD5. After submission, click"Host 'localhost' is not allowed to connect
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