One, method one
1) into the Var/lib/mysql
2 delete mysql file
3 Restart MySQL, to this password has been cleared
4) set a new password
echo "Grant all" *.* to ' root ' @ ' localhost ' identified by ' newpass '; Mysql-urootecho "Grant all" *.*
The simple requirement is to read a piece of data from a table, and then modify the data to insert the same one.
Table (assuming two table structures)
INSERT into new tableSELECT * from old tableCopy data from old table to new table (assuming two
The length function can test for character lengths in the specified field, but some attentive friends will find that the length function is different from the lengths of the coded tests.
Utf-8: Length () 3 lengths of a Chinese character
Gbk:length
1, use case to redefine the numeric type SELECT Id,title,(case date, ' 0000-00-00 ' THEN ' ELSE date end) As DateFrom your_tableSELECT Id,title,(Case status when 0 THEN ' open ' if 1 THEN ' close ' ELSE ' standby ') As StatusFrom your_table 2, find
Master configuration:
The code is as follows
Copy Code
Log-bin = Mysql-binServer-id = 1Binlog-do-db = Powerdns #要同步的数据库
Master new Slave Account:
The code is as follows
Copy Code
Main:Configure my.confLog-bin=mysql-binServer-id = 1Binlog-do-db=jinrimingpin_comBinlog-do-db=jinripinpai_comBinlog-do-db=jinritemaihui_comBinlog-do-db=mingpintejia_comBINLOG-DO-DB is a database that allows synchronization. One line.Show MASTER
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,
1, the Sub-Library table
Obviously, a primary table (that is, a very important table, for example, user table) Unlimited growth is bound to seriously affect performance, the library and the table is a very good solution, that is, the performance
Example
ID UID Content Weid addtime1 2 3213123 12 ...2 3 3213123 12 ....3 2 321312 12 ...3 1 XXX 12 3232
Our requirement is to drop out the nearest user from the message table, which was written in the first time.
The code is as
Today, I went to a network construction company in Suzhou for an interview, the boss gave me a question: how to take a random piece of data from a datasheet in PHP?
Of course, at the end of my code there is a mistake, not in the real sense of
Can only say that I food, found on the internet did not find who explained their four differences, it can only own. The following is a MySQL client to see the help information, directly posted to explain it.
User:returns the current MySQL username
Some colleagues in the PHP discussion group mentioned that he did a project because the MySQL query returned too many results (up to 100,000), resulting in insufficient PHP memory. So, he asks, is the data already in memory before executing the
The simplest use of the Date_format function for comparison
The code is as follows
Copy Code
SELECT * from TB where c> date_format (' 2007-07-06 ', '%y%m%d ') and C SELECT * from TB where c> date (' 2007-07-07 ') and c
If it does not exist, insert the new data
The code is as follows
Copy Code
$sql = "INSERT into {$ecs->table (' Cat_lang ')} (CAT_ID,LANG_ID,CAT_NAME,KEYWORDS,CAT_DESC)VALUES ({$cat _id},{$k}, ' {$val [' cat_name ']} ', '
Assuming the MySQL username and password is root xxx, the database is test
Import SQL
The code is as follows
Copy Code
Mysql-hlocalhost-uroot-pxxx Test
Exporting SQL
The code is as follows
INNER join (equivalent join) returns only rows with the same join field in two tablesLeft JOIN, which returns records that include all records in the left table and the join fields in the right tableRight join returns records that include all the
1. Calculation of years
You want to figure out how old this person is by birthdays.
The code is as follows
Copy Code
SELECT Date_format (From_days to_days (now ())-To_days (@dateofbirth)), '%Y ') + 0;
2. The
We talked about the view created in the front, today this tutorial we will talk about the MySQL tutorial view changes and updates.
View Modifications .
Grammar:
Alter [Algorithm ={undefined |merge | temptable}] View view_name [(collist)] as
System Configuration: win2000 English version + JDK1.4.1 + TOMCAT4.0.5 + APACHE2.043Development cycle: the development cycle lasts for nearly 15 days.Functions:1. Gallery:Submit, display, and delete images and related text by page.2. Album:Album
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