MySQL's master-slave replication is the basis for a large-scale MySQL cluster, which is widely used in daily production environments, The MySQL5.6 began to make great progress in MySQL's master-slave replication after the continuous refactoring of
1. Database table operations:
-Start the MySQL server first, open the CMD window in the directory where MySQL is installed, and run MySQL: ' mysql.exe-hlocalhost-p3306-uroot-p123456 ';
-View all databases: show databases; --Create DATABASE
Aes_encrypt (Str,key)Returns the result of encrypting the string str with the key key using the Advanced Encryption Standard algorithm, the result of calling Aes_encrypt is a binary string, stored as a BLOB typeAes_decrypt (Str,key) Returns the
1. CursorsA cursor is a data buffer opened by the system for the user, which holds the results of the SQL statement executionThe user can use the SQL statement to get the records from the cursor one by one, and assign the main variables to Python
1.in and existsin is the appearance and the inner table as a hash connection, and exists is the external loop loop, each loop loop and then query the internal table. The assertion that exists is more efficient than in is inaccurate. The subquery
1. Upload the tar package to the server and unzip the tar package to the/usr/local/directorycd/usr/local/TAR-XVF Mysql-5.7.17-linux-glibc2.5-x86_64.tarTAR-ZXVF mysql-5.7.17-linux-glibc2.5-x86_64.tar.gzMV Mysql-5.7.17-linux-glibc2.5-x86_64 MySQL2.
One, MySQL businessA transaction is a logical set of SQL operations that make up the individual SQL statements of this set of operations, either completely successful or fail at execution time.For example, Xiao Ming to the small red transfer 100
Machine standardization: Server hardware configuration (CPU, hard disk, memory, RAID) to be consistentDirectory standardization: MySQL installation directory, storage data directory, log files, etc., on multiple machines to be unified
On the basis of three tables:CREATE TABLE Customer (ID varchar (primary key),Name varchar (16),Sex varchar (2),Mobile varchar (11),Address varchar (50),);CREATE TABLE Orderbook (CSID varchar (10),Cmid varchar (12),Count Int (11),Bookdate
1. //log in to databaseMysql-u root-pvmwaremysql>Use MySQL; //% can be accessed remotely for all IPsMysql>update UserSetHost ='%' whereuser ='Root'; //or just add a statement.Mysql>insert into User (Host,user,password) VALUES ('192.168.0.51','Root',
Query data: SELECT * from XXX;Example:(1) Select Id,username,password from T_user;(2) Select Id,username,password,gender from t_user where gender = ' male ';(3) Select Id,username,password,gender from t_user where gender is null;
Add data: Insert
Environment Introduction:Primary server (Master): 192.168.100.155Slave Server (slave1,slave2): 192.168.100.153-154Proxy Server (amoeba): 192.168.100.156App Client (APP): 192.168.100.1571. Build the time server:The NTP Time service is installed on
Physical file compositionLog files: error log, query log, slow query log, transaction log, binary logLogs are a part of the MySQL database's perception. Log files record changes in the running of the honing MySQL database, which is used to record
First, log in to MySQL1. Start:MySQL boot file in the/ETC/INIT.D directory, start running the following command/etc/init.d/mysql start2. Stop:/usr/bin/mysqladmin-u root-p shutdown3. Login:MySQL [-u username] [-h host] [-p password] [dbname]Here we
The main differences between MySQL 4.1/5.0/5.1/5.5/5.6 versions5.0 increased the support of stored procedures, views, Cursors, Triggers, XA transactions, and added the Inforation_schema system database.Second, 5.1 added event
1. Download MySQL from official website :http://dev.mysql.com/downloads/2. Unzip to the directory you want to install (Bo master installation to: D:\mysql) Add a new My.ini file and write the following: Press CTRL + C to copy the codePress CTRL +
While for exampleDROP PROCEDURE IF EXISTS Zy.test_pro;DELIMITER $$CREATE PROCEDURE Zy.test_pro (in ID INT)BEGINDECLARE num INT;SET Num=1;While Num INSERT into Zy.test VALUES (num,concat (' Test ', num));SET num = num +1;END while;END;RepateDelimiter/
MySQL Schema and data type optimization, mysqlschema
Select the Optimized Data Type:
1. Smaller ones are usually better:
In general, try to use the minimum data type that can properly store data. Smaller data types are usually faster, because they
Mysql Chinese sorting and mysql sorting
When sorting mysql in Chinese and English or arrays, you can directly use order by colName (asc | desc) without having to focus on the encoding formats of databases, tables, and fields.
However, if a field
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