Functions for escaping special characters in PHP MySQL
One is: mysql_escape_string
One is: addslashes
The difference between mysql_escape_string and addslashes is that
Mysql_escape_string always converts "'" to "\"
And addslashes
Convert "'"
MySQL migration toolkit is a database migration tool officially provided by MySQL. It can convert any data source to MySQL DATA, or convert Mysql Data to other types of data. Java support required
Supported database migration
Because the default character encoding of MySQL is Latin1, most non-letter characters are not supported. Therefore, after installation, you must modify the character encoding first.
Open the my. ini file in the MySQL installation directory.
The
1. View
A view is a virtual table. Unlike tables that contain data, a view only contains queries for dynamically retrieved data during use (that is, including an SQL query). It is only a facility for viewing data stored elsewhere.
Basic View
Turn: http://www.21andy.com/blog/20071102/655.html
Command for backing up MySQL databaseMysqldump-hhostname-uusername-ppassword databasename> backupfile. SQL
Back up the MySQL database in the format of a table with deletionBacking up a MySQL
Check the default link encoding of MySQL on the master and slave servers, especially the slave server. Otherwise, garbled characters may occur during synchronization.
[Mysqld]
Server-id = 2Slave-Skip-errors = allDefault-character-set =
MySQL primary and foreign key creation:(1) Ensure that the referenced tables and fields exist.(2) The associated table must be of the InnoDB Storage type.(3) The primary key of the primary join table must be set.(4) The primary key and foreign key
Modify the my. ini file
Add
Default-character-set = gb2312
Set database character sets
Alter database da_name default Character Set 'charset'
1) set the database encoding/etc/My. CNF[Mysqld]Default-character-set = GBK...[Client]Default-character-set
Http://hi.baidu.com/289766516/blog/item/a3f85500556e2c09728da5e1.html
Method 1:Truncate table your table name// This not only deletes all data, but also relocates the auto-increment Field
Method 2:Delete from your table nameDBCC checkident (your
In SQL, we sometimes use in the query statement to query related data. For example:
Select * from goods where goods_id in ('20160301', '64', '20160301', '37', '20160301', '20160301', '20160301 ', '123', '123', '123', '123 ')
In the preceding
Sometimes we need to optimize MySQL. So what improvements should we make to MySQL? A special query? Database mode? Server hardware? The only way is to measure what your system is doing and its performance under various conditions. This is what we
This parameter means that before the table is closed, the update operation of the table refers to the disk with the new data instead of the index to the disk, and the changes to the index are recorded in the memory. In this way, the MyISAM table can
There are two tables, Table
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->CREATE TABLE `a` (`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,`fid` smallint(6) unsigned NOT NULL DEFAULT '0',`cnt`
In most cases, when the alter table operation is performed, a temporary backup of the target table (temporarily named a) is copied (temporarily named B). The alter operation is performed on the backup file (B) and then delete the target table (a).
I have only recently started working heavilyWith stored procedures and functions in MySQL. After years inOracle world with advanced stored procedures, functions and packages,I 've had to come to grips with the same comings of MySQL. One of thoseIs
The following methods are used to test on my VM. The memory is 384 Mb, the swap partition is 1024 MB, and the test has 3.5 million data records. The requirement is as follows:
Code highlighting produced by Actipro CodeHighlighter
As the name implies, "memory tables" are created in the memory. Is that true? In fact, the MySQL memory table and table structure are created on the disk and the data is stored in the memory. Therefore, when MySQL is started, the table exists and
There are many possible causes of garbled characters, but they are usually caused by inconsistent encoding. The Garbled text problem today is caused by inconsistent file encoding and database connection encoding, to add initialization data for batch
6.4.1. Dumping data in SQL format
Mysqldump
This section describes how to useMysqldumpTo create SQL-format dump files. For information about reloading such dump files, see Section 6.4.2, "reloading SQL-format backups ".
By default,MysqldumpWrites
Simple MySQL database operations1. Create a database
Use the show databases command to display the names of all created databases.Create Database xxx; Create a database named XXX.
For example, mysql> Create Database test;
Ii. Create a form
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.