This is what I wrote today when I wrote a table that would import a database's table data into another database.
Copy Code code as follows:
Header ("Content-type:text/html;charset=utf-8");
$conn = mysql_connect ("localhost",
We will inevitably be thoughtless in the process of creating a table, so we later modify the table
ALTER TABLE statements are required to modify tables
Modify Table Name
Copy Code code as follows:
mysql> ALTER TABLE student rename
An index is a structure created on a table that sorts the values of one or more columns in a database table.
Its main function is to improve the speed of query and reduce the performance cost of database system.
Through the index, the query data
MySQL password expired, today encountered a connection to MySQL, always connected not up,
Error Symptom 1:
An attempt by a client to checkout a Connection has timed out
The first time a connection timeout error occurred, the first reaction is to
View version Information
#1使用命令行模式进入mysql会看到最开始的提示符
Your MySQL Connection ID is 3
Server version:5.1.69 Source Distribution
#2命令行中使用status可以看到
Copy Code code as follows:
mysql> status;
--------------
MySQL Ver 14.14 distrib 5
Creating triggersCreate a trigger with only one execution statement
Copy Code code as follows:
CREATE TRIGGER Trigger Name before| After Trigger event
On table name for each ROW EXECUTE statement
Where the trigger name
The data is very important, this point with toes to know, in order to ensure data security, so the need to regularly backup data
Let's write a few notes about data backup and restore
Data backup
Backing up a database using the mysqldump command
Show STATUS
Login directly under the command line MySQL run show STATUS; query statements, detailed below
The same statement and show Variables;,show status is to look at the MySQL operation, and the above kind of information through the PMA look
1. Each client connection is divided into a thread belonging to it from the server process. The corresponding query for the connection is processed through that thread.
2. The server caches threads. Therefore, no threads are created or destroyed
UTF8 Character Set:
Sql>create table test (id int auto_increment,name varchar (), primary key (ID));
Sql>insert into test values (null, ' 1234567890 ');
Query OK, 1 row Affected (0.00 sec) Sql>insert into test values (null, ' 1,234,567,890 ');
In fact, these two are different, last_insert_id () can return the bigint value of the ID. Instead, MYSQL_INSERT_ID returns an int. If you
The ID is unsigned int, or bigint. Well, it may be wrong to return it. Instead, use LAST_INSERT_ID () instead.
Objective
During the work process, various business requirements require an order by sort when accessing the database. Sometimes unnecessary or unreasonable sort operations are likely to cause the database system to crash. How do I handle a good
The SQL Select command is used to fetch data from the MySQL database. You can use this command at the mysql> prompt or using scripts such as PHP.Syntax:
The following is the syntax of the generic SQL SELECT command to extract data from the MySQL
Sometimes we use the penultimate record of the query.
Copy Code code as follows:
Last=holderchangehistory.find_by_sql
(["Select * from Holder_change_histories
where treasure_id =?
ORDER BY id DESC
Limit 1,1 ",
@hch. treasure_
You can use the IN clause instead of the combined "greater than equals and less than equals" condition.
The EMPLOYEE_TBL table to understand the BETWEEN clause has the following records:
Mysql> SELECT * from EMPLOYEE_TBL;
+------+------+----
After installing the WAMP, an error occurred while trying to link MySQL with phpMyAdmin, and the error is as follows:
phpMyAdmin tried to connect to the MySQL server, but the server refused to connect. You should check the host, username, and
In a MySQL replication environment, we usually judge slave delays only based on the value of Seconds_behind_master. This is acceptable in most cases, but not accurate enough to consider more factors.
First, let's look at the state of the Slave:
This time, let's take a look at the impact of index, submit frequency on InnoDB table write speed, and see what needs to be noted.
Let's just say a few conclusions:
1, about the impact of the index on the write speed:A, if there is a self-added
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