Differences between char and varcharChar (13) is fixed in length. For example, the storage space of 'www .jb51.net' must be 12 characters long.Varchar (13) Variable Length: for example, 'www .jb51.net' requires a bucket of 13 characters,From the
Analyze Table When optimizing SQL statements, MySQL Optimizer must first collect related information, including the cardinality of the table (which can be translated as "hash degree "), it indicates the number of different values in the column
If the fields of the two tables are consistent and you want to insert all the data, you can use this method:Code:Copy codeThe Code is as follows:Insert into target table SELECT * FROM source table; For example, to insert the articles table to the
1. Create a user. // Log on to MYSQL@> Mysql-u root-p@> Password// Create a userMysql> insert into mysql. user (Host, User, Password, ssl_cipher, x509_issuer, x509_subJect) values ("localhost", "pppadmin", password ("passwd "),'','','');In this way,
How much data does MySQL support? In fact, the upper limit of a single MySQL table is mainly related to the maximum file size supported by the operating system. Let's take a look at the official introduction.1.4.4. Maximum number of MySQL
1. Connect to MYSQL.Format: mysql-h host address-u user name-p User Password1. Example 1: connect to MYSQL on the local machine.First, open the DOS window, enter the directory mysqlbin, then type the command mysql-uroot-p, and press enter to prompt
Record some select tips:1. select statements can be separated by carriage return.$ SQL = "select * from article where id = 1"And $ SQL = "select * from articleWhere id = 1 "can get the correct results, but sometimes it is clearer to write separately,
MySQL supports two main table storage formats: MyISAM and InnoDB. InnoDB was used for a project last month. The results are very slow and only a dozen pieces can be inserted in one second. Later I changed to MyISAM format and inserted tens of
Because of its openness and Stability of the source code, and its perfect combination with the popular compilation of PHP, many websites now use it as a back-end database, making it widely used. In terms of security, each user must be given access
There are two different ways to add users: using the GRANT statement or directly operating the MySQL authorization table. The better way is to use the GRANT statement, because they are more concise and seem to have fewer errors.The following example
How to obtain the number of occurrences of a long string in SQLFor example, there is a string:
X-BGS-2010-09-15-001
I want to know the number of occurrences of '-', which can be implemented using the following method without complex one-Character
Table a (id, type ):Id type----------------------------------1 12 13 2Table B (id, class ):Id class---------------------------------1 12 2SQL statement 1: select a. *, B. * from a left join B on a. id = B. id and a. type = 1;SQL statement 2: select
1. Stop mysql services first.2. Change the master path of database storage in MySQL configuration file My. iniOpen the default MySQL installation folder C: \ Program Files \ MySQL Server 5.1 In my. INI file, click "edit" and "Search" at the top of
First, let's take a look at the basic principles of paging:Copy codeThe Code is as follows:Mysql> explain SELECT * FROM message order by id desc limit 10000, 20G ******************* 1. row ************** id: 1 select_type: SIMPLE table: message type:
In-depth analysis of MySQL database backup and restoration in Linux 1. Backup[Root @ localhost ~] # Cd/var/lib/mysql (go to the MySQL database directory and adjust the directory based on your MySQL installation)[Root @ localhost mysql] # mysqldump-u
I. Purpose of backup
Disaster recovery: recover and restore damaged dataDemand change: data needs to be restored to a time before the change due to demand changesTest: test whether the new function is available
Ii. Backup considerations
How long
When using the following two methods, the field must be set to "primary key" or "UNIQUE constraint (UNIQUE )".1: Use replace into (This method uses the replacement method, which is a bit similar to deleting and then inserting)Copy codeThe Code is as
01#! /Bin/sh02# Code by scpman03# Function: Check and fix mysql database tables04# Add the script to the timer. When the script is executed, it will read the database, list all the tables to be repaired, timing them, and start fixing.05# The damaged
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.