MySQL « 邵珠庆の博客

邵珠庆の博客 生命只有一次,你可以用它来做些更多伟大的事情–Make the world a little better and easier

17十/160

MySQL中的mysqldump命令使用详解

发布在 邵珠庆

就用 --ignore-table=dbname.tablename参数就行了。 

mysqldump -uusername -ppassword -h192.168.0.1 -P3306 dbname --ignore-table=dbname.dbtanles > dump.sql

 

导出要用到MySQLmysqldump工具基本用法是:
shell> mysqldump [OPTIONS] database [tables]
如果[......]阅读全文

10十/160

一篇文章学会Mysql分区表的管理与维护

发布在 邵珠庆

定义: 

       表的分区指根据可以设置为任意大小的规则,跨文件系统分配单个表的多个部分。实际上,表的不同部分在不同的位置被存储为单独的表。用户所选择的、实现数据分割的规则被称为分区函数,这在MySQL中它可以是模数,或者是简单的匹配一个连续的数值区间或数值列表,或者是一个内部HASH函数,或一个线性HASH函数。

使用场景:

     1.某张表的数据量非常大,通过索[......]阅读全文

27四/160

重启mysql提示MySQL server PID file could not be found!

发布在 邵珠庆

重启mysql提示MySQL server PID file could not be found!

Starting MySQL...The server quit without updating PID file (/usr/local/mysql/data/rekfan.pid).

我只能呵呵了吗?不是。

我是这样做的,先看下是不是有这个进程,然后结束,再重启,代码:

  1. ps -ef|grep mysqld 
  1. kill&n

[......]阅读全文

22十二/150

MYSQL explain详解

发布在 邵珠庆

explain显示了mysql如何使用索引来处理select语句以及连接表。可以帮助选择更好的索引和写出更优化的查询语句。

先解析一条sql语句,看出现什么内容

EXPLAINSELECTs.uid,s.username,s.name,f.email,f.mobile,f.phone,f.postalcode,f.address FROM uchome_space ASs,uchome_spacefieldASf WHERE 1  AND s.groupid=0 AND s.uid=f.uid

1. id

SELECT识别符。这是SELECT查询序列号。这个不重要,查询序号即为sql语句执行的顺序,看下面这条sql

EXPLAINSELECT*FROM(SELECT* FROMuchome_space LIMIT10)ASs[......]阅读全文

11六/150

MySQL Date and Time Functions

发布在 邵珠庆


Warning: file(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home1/vhost/vh499565/www/www1/wp-content/plugins/devformatter/devgeshi.php on line 100

Warning: file(http://svn.wp-plugins.org/devformatter/branches/langs/html5.php): failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home1/vhost/vh499565/www/www1/wp-content/plugins/devformatter/devgeshi.php on line 100

Warning: implode(): Invalid arguments passed in /home1/vhost/vh499565/www/www1/wp-content/plugins/devformatter/devgeshi.php on line 100

Warning: file(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home1/vhost/vh499565/www/www1/wp-content/plugins/devformatter/devgeshi.php on line 100

Warning: file(http://svn.wp-plugins.org/devformatter/branches/langs/html5.php): failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home1/vhost/vh499565/www/www1/wp-content/plugins/devformatter/devgeshi.php on line 100

Warning: implode(): Invalid arguments passed in /home1/vhost/vh499565/www/www1/wp-content/plugins/devformatter/devgeshi.php on line 100

Warning: file(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home1/vhost/vh499565/www/www1/wp-content/plugins/devformatter/devgeshi.php on line 100

Warning: file(http://svn.wp-plugins.org/devformatter/branches/langs/html5.php): failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home1/vhost/vh499565/www/www1/wp-content/plugins/devformatter/devgeshi.php on line 100

Warning: implode(): Invalid arguments passed in /home1/vhost/vh499565/www/www1/wp-content/plugins/devformatter/devgeshi.php on line 100

 html5 | 
 
 copy code |
?

01
Name Description
02
ADDDATE() Add dates
03
ADDTIME() Add time
04
CONVERT_TZ() Convert from one timezone to another
05
CURDATE() Return the current date
06
CURRENT_DATE(), CURRENT_DATE Synonyms for CURDATE()
07
CURRENT_TIME(), CURRENT_TIME Synonyms for CURTIME()
08
CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP Synonyms for NOW()
09
CURTIME() Return the current time
10
DATE_ADD() Add two dates
11
DATE_FORMAT() Format date as specified
12
DATE_SUB() Subtract two dates
13
DATE() Extract the date part of a date or datetime expression
14
DATEDIFF() Subtract two dates
15
DAY() Synonym for DAYOFMONTH()
16
DAYNAME() Return the name of the weekday
17
DAYOFMONTH() Return the day of the month (1-31)
18
DAYOFWEEK() Return the weekday index of the argument
19
DAYOFYEAR() Return the day of the year (1-366)
20
EXTRACT Extract part of a date
21
FROM_DAYS() Convert a day number to a date
22
FROM_UNIXTIME() Format date as a UNIX timestamp
23
HOUR() Extract the hour
24
LAST_DAY Return the last day of the month for the argument
25
LOCALTIME(), LOCALTIME Synonym for NOW()
26
LOCALTIMESTAMP, LOCALTIMESTAMP() Synonym for NOW()
27
MAKEDATE() Create a date from the year and day of year
28
MAKETIME MAKETIME()
29
MICROSECOND() Return the microseconds from argument
30
MINUTE() Return the minute from the argument
31
MONTH() Return the month from the date passed
32
MONTHNAME() Return the name of the month
33
NOW() Return the current date and time
34
PERIOD_ADD() Add a period to a year-month
35
PERIOD_DIFF() Return the number of months between periods
36
QUARTER() Return the quarter from a date argument
37
SEC_TO_TIME() Converts seconds to 'HH:MM:SS' format
38
SECOND() Return the second (0-59)
39
STR_TO_DATE() Convert a string to a date
40
SUBDATE() When invoked with three arguments a synonym for DATE_SUB()
41
SUBTIME() Subtract times
42
SYSDATE() Return the time at which the function executes
43
TIME_FORMAT() Format as time
44
TIME_TO_SEC() Return the argument converted to seconds
45
TIME() Extract the time portion of the expression passed
46
TIMEDIFF() Subtract time
47
TIMESTAMP() With a single argument, this function returns the date or datetime expression. With two arguments, the sum of the arguments
48
TIMESTAMPADD() Add an interval to a datetime expression
49
TIMESTAMPDIFF() Subtract an interval from a datetime expression
50
TO_DAYS() Return the date argument converted to days
51
UNIX_TIMESTAMP() Return a UNIX timestamp
52
UTC_DATE() Return the current UTC date
53
UTC_TIME() Return the current UTC time
54
UTC_TIMESTAMP() Return the current UTC date and time
55
WEEK() Return the week number
56
WEEKDAY() Return the weekday index
57
WEEKOFYEAR() Return the calendar week of the date (1-53)
58
YEAR() Return the year
59
YEARWEEK() Return the year and week
60
ADDDATE(date,INTERVAL expr unit), ADDDATE(expr,days)

When invoked with the INTERVAL form of the second argument, ADDDATE() is a synonym for DATE_ADD(). The related function SUBDATE() is a synonym for DATE_SUB(). For information on the INTERVAL unit argument, see the discussion for DA[......]阅读全文

14四/150

mysql 中文字段排序( 按拼音首字母排序) 的查询语句

发布在 邵珠庆

在处理使用Mysql时,数据表采用utf8字符集,使用中发现中文不能直接按照拼音排序

 

如果数据表tbl的某字段name的字符编码是latin1_swedish_ci

select * from `tbl` order by birary(name) asc ;

 

如果数据表tbl的某字段name的字符编码是utf8_general_ci

 

SELECT name FROM `tbl` WHERE 1 ORDER BY[......]阅读全文

12十一/140

php/mysql/jquery实现各系统流行的瀑布流显示方式,实现很简单的!!!!

发布在 邵珠庆

大家在用这个东西的时候一定要计得有这么几个文件,一个是jquery.js 还有就是你自己数据库的密码。和相对应的图片才可以正常看到效果。下面就是这里所有的代码!!!

HTML文件:waterfall.html

1. [代码][PHP]代码     

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

[......]阅读全文

7十/140

linux下mysql的root密码忘记解决方法

发布在 邵珠庆

1.首先确认服务器出于安全的状态,也就是没有人能够任意地连接MySQL数据库。 
因为在重新设置MySQLroot密码的期间,MySQL数据库完全出于没有密码保护的 
状态下,其他的用户也可以任意地登录和修改MySQL的信息。可以采用将MySQL对 
外的端口封闭,并且停止Apache以及所有的用户进程的方法实现服务器的准安全 
状态。最安全的状态是到服务器的Console上面操作,并且拔掉网线。 
2.修改MySQL的登录设置:&n[......]阅读全文

   下一页