Open 2 command-line windows at the same time and do the following:
In the first command line window enter:
The code is as follows
Copy Code
CD D:\Program files\mysql\mysql Server 5.5\binnet stop MySQLMysqld--skip-grant-
1. Create the statement for the trigger:
CREATE TRIGGER
{before | After}
{INSERT | UPDATE | DELETE}
On
For each ROW
-Triggers
The code is as follows
Copy Code
--create Trigger name --on Table name --Trigger
Create a View
In MySQL, the complete syntax for creating a view is as follows:
CREATE [OR REPLACE] [algorithm = {UNDEFINED | MERGE | TempTable}]VIEW view_name [(column_list)]As Select_statement[With [cascaded | Local] CHECK OPTION
Its
MySQL master copy
How to install MySQL database, here do not say, only to say that its master-slave copy, the steps are as follows:
1, the master-slave server for the following operations:1.1, consistent version1.2, initialization of the table,
1. Script statement
Before importing, CharSet GBK first.
To modify a table field encoding:
Note: The data inserted here is imported, and the console will complain. Executed in our client tools, there is no error.
2. In MyBatis, the XML file is
MySQL itself supports an UPDATE statement to update multiple tables, which is sometimes a very useful feature.
multiple-table syntax
UPDATE [low_priority] [IGNORE] Table_referencesSET col_name1={expr1| DEFAULT} [, col_name2={expr2| DEFAULT}]
Mysqldump is a mysql-brought data import export tool, its official note is:
Shell> mysqldump [Options] db_name [tbl_name ...]Shell> mysqldump [options]–databases db_name ...Shell> mysqldump [options]–all-databases
To export an entire database
On the server command line login, Mysql-uroot-upassword, write the password to the command line, do not need to input each time, press ctrl+p and then enter, try N times, and finally logged in; The number of connections, after all, can still find a
Chinese Pinyin Whole spelling
The code is as follows
Copy Code
--Create a Chinese phonetic control temporary tableCREATE TABLE IF not EXISTS ' T_base_pinyin ' (' Pin_yin_ ' varchar (255) CHARACTER SET GBK not NULL,' Code_
Truncate usage
TRUNCATE [TABLE] Tbl_name
I want to delete all the records in the Friends table, you can use the following statement:
TRUNCATE TABLE friends;
Delete Usage
DELETE [low_priority] [QUICK] [IGNORE] from Tbl_name[WHERE
Entering commands on the command line is not a good idea and can create security problems. (see another article, "The safe operation of MySQL password entry") but if you decide to write an application, the application needs to use a password or
The principle of master copy of database:The master-slave copy of the database is replicated from the master database to the slave database, and three threads are required to implement the entire replication between master and slave, of which two
(1) MySQL replace functionSyntax: replace (object,search,replace)Replaces all occurrences of search in object with replace
The code is as follows
Copy Code
Update ' News ' Set ' content ' =replace (' content ', ', ', ')//
Recently also in the writing project encountered in this problem, need to combine two select query results grouped sorted, think of the Union method, with TP union operation can not complete the complex union operation, so the search for a moment,
MySQL has the following several logs:Error log: Log-errQuery log: LogSlow query log: log-slow-queriesUpdate log: Log-updateBinary log: Log-bin
[Client]Port = 3306Socket
Installed MySQL 5.5, found remote connection with the MySQL client, reported 1042-can ' t get hostname for the your address error, while the connection user has been authorized. This error means "your address can not get host name", I thought of the
Mysqlslap is an official MySQL-provided stress testing tool starting with version 5.1.4. Perform stress testing by simulating multiple concurrent client access to MySQL while providing detailed data performance reports for "High load attack MySQL".
I remember I used to write a diary in this site is a record of the master and slave MySQL Tutorial database tutorial synchronization Backup related articles, do not know that a friend has not seen, the method is very simple, is certainly can be
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