Sometimes we want MySQL to be able to do some database operations at startup, such as adding an index to the cache and so on. Because some of the configuration will expire after MySQL reboot, after reboot we can let MySQL re-execute some SQL
MySQL 5.6 X64 & CentOS 7 X64Main Library: 192.168.1.1From library: 192.168.1.21. Main Library ConfigurationVi/etc/my.confSet the following parameters under [mysqld]:Server-id=1 #主库标识Log_bin=mysql-bin #开启mysql二进制日志#binlog-do-db=mydb
My 1am,1pmNumeric type
Int (4)
Float (5,2)
Varchar (4)
Enum type
Enum (' female ', ' male ')
Set (' book ', ' Football ', ' A ' ....)
Constraint conditionsNull Default ExtraThe default is allow default
MySQL master-slave backup, listen to a noun is very tall, in fact, is the original implementation of MySQL, you only need a simple configuration can be achieved.The first step: Keep the master-slave two database is synchronous, preferably manually
Inserting records
INSERT [ into]Tbl_name[(col_name,...)]{VALUES |VALUE} ({expr| DEFAULT},...),(...),...//Law Two: The difference is that this method can use subqueries (subquery)INSERT [ into]Tbl_nameSET col_name={Expr|DEFAULT},...//method
First, the indexCreated: CREATE INDEX index_name on table_name (field)Delete: Drop INDEX index_name on table_nameIi. constraintsCREATE TABLE tablename (Field_name field_type {notnull,unique,check (filed>0), Primary key Auto_increment,constraint
Now is a manual primer, not too dependent on the IDE, using the MySQL JDBC Jar package to connect the database as follows:Demo File content: PackageCc.openhome;ImportJava.sql.*; Public classConnectiondemo { Public Static voidMain (string[]
1. Slow SQL consumes 70%~90% database CPU resources;2.SQL statement is independent of the program design logic, relative to the program source code optimization, the optimization of SQL statements in the cost of time and risk is very low;3.SQL
1.profile available in mysql5.0.37 and above2. See if profile is availableSELECT @ @profiling;to see if profile is enabled, and if the PROFILNG value is 0, you canSET profiling = 1;enabledmysql>select Count (*) from roi_summary;then show Profiles
One, MySQL variable type:MySQL uses variables to define the current server's characteristics, save state information, and so on. We can configure MySQL by manually changing the value of the variable, or we can get the current state information of
1. First, go into the environment, i.e. mysql-u root-p , then enter the original password2. mysql > will appear at this time3. Start Change Password: mysql > Use MySQL; mysql > Update user set password = password (' modified ') where user = '
a User Management1. Create user identified by ' password ';2. Delete users drop user xxx;3. Renaming users rename user xxx to xxxx;4. Modify the current user password setpassword=password (' xxxx ');5. Modify other user password setpassword for xxx
1. Using MYSQL-E to execute MySQL SQL statements in the script#!/bin/bash#simple MySQL Shell usagelogtime=`Date "+%y-%m-%d"' LOG=Call_sql_${logtime}.logEcho "Start Execute SQL statement at ' date '">>${log} #execute SQLStatMySQL-U
CREATE TABLE Table name(Whether the column name data type is empty (whether the primary key | is a unique | foreign key relationship),Column name data type ... (The last column does not have a comma))Create DATABASE nameInsert into database name.
MySQL Incremental backupPremise, the server needs to open the binary logmysql> SHOW BINARY LOGS; View all binary filesmysql> SHOW MASTER STATUS; View current binary filesMysqlbinlog Instructions for useMysqlbinlog A temporary table is generated when
MySQL Master-slave replication(Super Simple)How to install MySQL database, do not say here, just say its master-slave copy, the steps are as follows:1, the master-slave server for the following actions:1.1. Consistent version1.2. Initialize the
The first step is to download the JDBC driver: Mysql-connector-java.jar, put the jar package in JMeter lib\ext.
2. Add the jar package to the test plan, and see.650) this.width=650; "src="
MySQL entry (5)-create, modify, and delete tables
A table is the basic unit for storing data in a database. A table contains several fields or records. Table operations include creating, modifying, and deleting tables.
1. Create a table
Create a
MySQL paging optimization, mysql Paging
Recently, I helped my colleagues rewrite a MySQL SQL statement that involves two tables, one of which is a dictionary table (a field needs to be returned ), the other table is a business table (which contains 1
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