mysqlÆô¶¯Åöµ½¹ýµÄÎÊÌâ
ÎÒµÄmysql×°ÔÚ/usr/local/mysqlĿ¼ÏÂÆô
¶¯Åöµ½¹ýºÜ¶àÎÊÌâ¡£×î³£¼ûµÄÊÇ£º
ERROR 2002: Can't connect to local MySQL server through socket
'/tmp/mysql.sock' (111)
½â¾ö°ì·¨£º
[root@test mysql]# /usr/local/mysql/bin/mysqladmin -u root /
> -S /var/lib/mysql/mysql.sock password 'your.passwd'
»òÕß×ö¸öÁ¬½Ó
ln -s /var/lib/mysql/mysql.sock /tmp
ÆäʵÌáʾÕÒ²»µ½ /tmp/mysql.sockÓÐʱҲ²¢²»ÊÇ/tmpĿ¼ÏÂûÕâ¸öÎļþ£¬ÊÇÆô¶¯
ÃüÁî²»¶Ô£¬ÎÒÅöµ½¹ý
³£¼ûµÄ¼¸ÖÖÆô¶¯·½Ê½£¬×Ô¼ºÒ²²»ÊǼǵúÜÇå³þ£¬Èç¹ûÄãÈ·¶¨tmpÏÂÓÐmysql.sockÕâ
¸öÎļþ²»·ÁÊÔÊÔÁíÍâµÄ¼¸¸öÃüÁî
/usr/local/mysql/bin/mysql -u root -p
/usr/local/mysql/bin/mysqld --user=mysql&
/usr/local/mysql/bin/mysqld --user=root&
/usr/local/mysql/bin/mysqld_safe --user=root&
/usr/local/mysql/bin/mysqld_safe --user=mysql&
/usr/local/mysql/bin/safe_mysqld--uer=root&(×¢Òâsafe_mysqldÓë
mysqld_safeÊDz»Í¬µÄ£¬&±íʾmysqlÔÚºǫ́ÔËÐÐ)Îҵľͻᱨ´íÁË
STOPPING server from pid file
/usr/local/mysql/data/localhost.localdomain.pid
060304 11:46:21 mysqld ended
ÕâÊÇȨÏÞÎÊÌ⣬ÎÒµÄmysqlĿ¼ÊôÓÚrootÓû§£¬Ò²ÊôÓÚrootȺ×飬¸ÄÓÃmysqld_safeÆô¶¯¾ÍûÎÊÌâÁË£¬
´ó¼ÒֻҪעÒâÕ⼸¸ömysql,safe_mysqld,mysqld_safe,mysqld,mysqladmin.¶àÊÔ
¼¸´Î
ÆäʵÓÐʱmysqlÒѾÕý³£Æô¶¯ÁË£¬²é¿´mysqlÊÇ·ñÆô¶¯ÃüÁî
ps -aux | grep mysqld
»á¿´µ½ÈçÏÂÀàËÆÄÚÈÝ
mysql 6394 0.0 1.5 10528 992 pts/3 S 16:16 0:00
/usr/local/mysql/
mysql 6395 0.0 1.5 10528 992 pts/3 S 16:16 0:00
/usr/local/mysql/
mysql 6396 0.0 1.5 10528 992 pts/3 S 16:16 0:00
/usr/local/mysql/
root 6422 0.0 1.1 2408 732 pts/3 S 16:20 0:00 grep
mysql
²é¿´mysqlÊÇ·ñÔÚ¼àÌý¶Ë¿ÚÃüÁî
netstat -tl | grep mysql
»á¿´µ½Èç
Ïà¹ØÎĵµ£º
MySQL½¨Á¢ÁÙʱ±íµÄÓï¾äÈçÏÂ:
CREATE TEMPORARY TABLE tmp (
article INT(4) UNSIGNED ZEROFILL DEFAULT '0000' NOT NULL,
price DOUBLE(16,2) DEFAULT '0.00' NOT NULL);
--LOCK TABLES article read;
--ÏȲåÈëÊý¾Ýµ½ÁÙʱ±í
INSERT INTO tmp SELECT article, MAX(price) from shop GRO ......
ÎÒÔÚ EMS SQL Manager 2005 for MySQL Õâ¸ö MySQL ͼÐοͻ§¶ËÏ¿ÉÒÔ˳ÀûÔËÐС£µ«ÊÇÔÚ SQLyog MySQL GUI v5.02 Õâ¸ö¿Í»§¶Ë¾Í»á³ö´í¡£×îºóÕÒµ½ÔÒòÊÇûÓÐÉèÖúà delimiter µÄÎÊÌ⡣ĬÈÏÇé¿öÏ£¬delimiter “;” ÓÃÓÚÏò MySQL Ìá½»²éѯÓï¾ä¡£ÔÚ´æ´¢¹ý³ÌÖÐÿ¸ö SQL Óï¾äµÄ½áβ¶¼Óиö “;”£¬Èç¹ûÕâʱºò£¬Ã¿ ......
MySQLÖ§³Öµ¥Ïò¡¢Òì²½¸´ÖÆ£¬¸´Öƹý³ÌÖÐÒ»¸ö·þÎñÆ÷³äµ±Ö÷·þÎñÆ÷£¬¶øÒ»¸ö»ò¶à¸öÆäËü·þÎñÆ÷³äµ±´Ó·þÎñÆ÷¡£Ö÷·þÎñÆ÷½«¸üÐÂдÈë¶þ½øÖÆÈÕÖ¾Îļþ£¬²¢Î¬»¤ÈÕÖ¾ÎļþµÄÒ»¸öË÷ÒýÒÔ¸ú×ÙÈÕ־ѻ·¡£µ±Ò»¸ö´Ó·þÎñÆ÷Á¬½Óµ½Ö÷·þÎñÆ÷ʱ£¬Ëü֪ͨÖ÷·þÎñÆ÷´Ó·þÎñÆ÷ÔÚÈÕÖ¾ÖжÁÈ¡µÄ×îºóÒ»´Î³É¹¦¸üеÄλÖᣴӷþÎñÆ÷½ÓÊÕ´ÓÄÇʱÆð·¢ÉúµÄÈκθüУ¬È ......
ËùÓеÄÊýѧº¯ÊýÔÚÒ»¸ö³ö´íµÄÇé¿öÏ·µ»ØNULL¡£
-
µ¥Ä¿¼õ¡£¸Ä±ä²ÎÊýµÄ·ûºÅ¡£
mysql> select - 2;
×¢Ò⣬Èç¹ûÕâ¸ö²Ù×÷·ûÓëÒ»¸öBIGINTʹÓ㬷µ»ØÖµÊÇÒ»¸öBIGINT£¡ÕâÒâζ×ÅÄãÓ¦¸Ã±ÜÃâÔÚÕûÊýÉÏʹÓÃ-£¬ÄÇ¿ÉÄÜÓÐÖµ-2^63£¡
ABS(X)
·µ»ØXµÄ¾ø¶ÔÖµ¡£
mysql ......
ÒÑÖªµ±Ç°¼Ç¼idΪ$id,È¡³öµ±Ç°¼Ç¼µÄÉÏÒ»Ìõ¼Ç¼ºÍÏÂÒ»Ìõ¼Ç¼µÄid,title×ֶΡ£±íÃûnews¡£
$sql = "SELECT CASE WHEN SIGN(id - $id) > 0 THEN MIN(id) WHEN SIGN(id - $id) < 0 THEN MAX(id) END AS id,title from news WHERE id <> $id GROUP BY SIGN(id - $id) ORDER BY SIGN(id - $id)"; ......