The code is as follows
Copy Code
mysql_query ("Set names ' utf8′"); Set the Write encoding first
If you set the code, there will be no garbled problem.
PHP Settings page encoding
The code is as follows
What is a table, from the superficial point of view, is to divide a table into n multiple small tables
MySQL's table is a real table, a table divided into many tables, each small table is the end of a table, all correspond to three files, one. MyD
My most common method is
The code is as follows
Copy Code
Delete ID duplicate data, suitable for ID is manual primary keyDelete Person as a from as a,(Select *,min (ID) from person GROUP by ID having count (1) > 1) as
For example, by using the title to retrieve a news library, the keyword may contain both Chinese and English, the following SQL statement:
Select Id,title,name from achech_com.news where title like '%a% '
Returns, some title fields are determined
Resolve failed to start
A, first use the command C:/Program files/mysql/bin/mysqladmin-u root-p shutdown to close MySQL
B, and then under the cmd command line, execute net start MySQL to start MySQL.
Hint: Plugin ' InnoDB ' registration as a
Method uses the Reset script
The code is as follows
Copy Code
wget Http://xxxx/lnmp/ext/reset_mysql_root_password.sh;sh reset_mysql_root_password.sh
Suitable for LNMP or MySQL admin scripts in/etc/init.d/mysql
Here is the test table, which tests the SQL
The code is as follows
Copy Code
CREATE TABLE IF not EXISTS ' test ' (' ID ' int (a) unsigned not NULL auto_increment,' Install ' int (a) unsigned not NULL,' Day ' int (a)
Method 1----"MySQL is case-insensitive when querying strings, and when compiling MySQL, it usually takes the ISO-8859 character set as the default character set, so in the comparison processThis phenomenon is caused by the case conversion of Chinese
Method One
The problem of using UTF-8 encoding in MySQL database
1. When creating databases and datasheets with phpMyAdmin, set the collation to: "Utf8_general_ci" or execute the statement:
CREATE DATABASE ' dbname ' DEFAULT CHARACTER SET UTF8
Error occurred while I was performing insert ABC (a) VALUES (' Bfdsafdsafdsafdsa ') : #1264-out of Range value adjusted for column ' A ' at row 1
Cause analysis
We see it in English because the length of the field is not enough
Solutions
Modify
Modify MySQL configuration to solve garbled
First of all:
With show variables like "%colla%"; "Varables" and "%char%"; these two commands view the database and server-side character set settings
If the view is gbk2312, or GBK, then you can only
The MySQL INSERT into statement is often used in the actual application of the statement, so the relevant content or a lot of good grasp.
Inserting data into a database tableThe INSERT into statement is used to add a new record to a database table.
(1) MySQL replace function
Syntax: replace (object,search,replace)
Replaces all occurrences of search in object with replace
Case:
The code is as follows
Copy Code
1 Update ' News ' Set ' content ' =replace (' content
1. Use the Library of API functions provided by MySQL.This is how many well-known MySQL client tools are implemented, as is the famous Winmysql tool. This can be achieved in most development tools. such as VC,BCB,DELPHI,VB and so on, as long as can
/*** Output a table in a database into a CSV file** @param string MySQL database host* @param string database name* @param the table name in the string database* @param the connection user name of the string database* @param the connection password
The first way
Update id= "UpdateBatch" parametertype= "Map" >Update AA SetA=#{FPTM},B=#{csoftrain}where C in#{item}
But the values of the fields that are modified in this way are the same.
The second way
Note If you want to modify the database
1. Install Nginx + MariaDB (MySQL)The Nginx version in the official Ubuntu source is too low, so we should first add ppa:Sudo apt-get install python-software-properties-commonSudo add-apt-repository ppa: nginx/stableSudo apt-get updateThen install
1: First install apache: open the terminal (ctrl + Alt + t ),Enter the following command:Sudo apt-get install apache2To install,After installation, open your browser and enter localhost or http: // 127.0.0.1 in the address bar.If you see It works,
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