# mysqladmin Flush-hosts
Now we go into the MySQL editor my.cnf
# VI/ETC/MY.CNF
Then add in the inside
max_connect_errors=10000
# Service Mysqld Restart
Then restart the MySQL database server, if you do not have the server permissions we can
MySQL Bulk substitution specified field string statement
UPDATE data table name set field name = Replace (field name, ' String to replace ', ' replace with ') WHERE set condition;
Example
The code is as follows
Copy Code
1. Query, can not use * do not use, try to write full field name.
2. The more indexes are not the better, each table is controlled within 6 indexes. The index does not work in the case of a range where condition, such as where value
3. In most
Inquire
The code is as follows
Copy Code
SELECT * FROM table1 WHERE table1.id in (1, 2, 3, 4, 5, ..., 999999)
Delete
The code is as follows
Copy Code
DELETE from ' table1 ' WHERE '
Human flesh update is a very scary thing. So I searched for a way to use the MySQL batch replacement field!
1. Use phpMyAdmin to enter the database management, search http://wenwen.soso.com, you can see which tables contain this field.2. Click SQL,
I wrote a random test.php. Linked database test, the results show:
Could not connect:mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use a administration tool to reset your password with the command SET
Below we understand some MySQL optimization foundation, MySQL optimization I divide into two parts, one is the server physical hardware optimization, the second is the MySQL itself (my.cnf) optimization.
The impact of server hardware on MySQL
1 case sensitivity of authorization table range columns+--------------+-----+-----+---------+----+-----------+------------+| Column | Host | User | Password | Db | table_name | column_name || Case Sensitivity | No | Yes | Yes | Yes | Yes | No |+-----
Mysql ifnull operation
Project, the value in the query results is set to the default value when the SQL query field is empty. The most stupid way of course is to process the query results, traversing the query results, when empty, set its value:
One, correct configuration file, clear cache
1. In the face of this problem, do not rush to reinstall the MySQL database, in fact, the solution is very simple, people need to clean up the Windows cache directory on it.2. Press "Windows key +r" to
So how do you solve the sorted output of the grouped data according to the DESC of the primary key?
There are two ways of answering:
1, the use of subqueries first sorted the table, and then the Word table for group by query, the resulting column
One, uptime can view the running time of the system
Show global status like ' uptime ';
Second, use the Linux command to view
[Root@dbserver ~]# ps aux | grep MySQLRoot 29090 0.0 0.0 70232 1364? S Jun05
SQL Lock table Reconciliation lock MySQL Tutorial statement
For MySQL, there are three types of lock levels: page level, table level, row level
The typical page-level representative engine is BDB.The typical representative engine for the table
Table structure:Copy code code as follows:----The structure of the table ' category '--CREATE TABLE IF not EXISTS ' category ' (' id ' int (one) not NULL auto_increment,' Type ' int (one) not NULL COMMENT ' 1 for Article Type 2 for product Type 3
Calculate the number of yearsIf you want to calculate the age of the person by birth, you can use the following statement:
SELECT Date_format (From_days to_days (now ())-To_days (@dateofbirth)), '%Y ') + 0;
2. Two difference in timeGets the
Setting up a MySQL configuration file
/etc/mysql/my.cnfFind Bind-address =127.0.0.1 to comment it out;//function is to make it no longer allowed only local access;
Restart Mysql:/etc/init.d/mysql restart;
Access to MySQL Database
Mysql-u
1. The capacity of the data: how many data in 1-3 years, how many bytes per piece of data;
2. Data items: whether there are large segments, the values of those fields are often updated;3. Data query SQL Condition: Which data item's column name
MySQL tutorial sexplain syntax and usage
Explain [extended] select ... from ... where ...
If extended is used, then after the explain statement is executed, you can use the show warnings statement to query the corresponding
Optimization
(1) mysql_connect (host, user name, password );Returns a connection number.Note: the passwords of mysql users can change with the IP address of the user's machine.In addition, mSQL does not have a user name mechanism, so msql_connect only needs one
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