¸ü¸ÄMySQLĿ¼µÄ·½·¨
ÀýÈ磬MySQLĬÈϵÄÊý¾ÝÎļþ´æ´¢Ä¿Â¼Îª/var/lib/mysql¡£¼ÙÈçÒª°ÑĿ¼ÒƵ½/home/dataÏÂÐèÒª½øÐÐÏÂÃ漸²½£º
1¡¢homeĿ¼Ï½¨Á¢dataĿ¼
cd /home
mkdir data
2¡¢°ÑMySQL·þÎñ½ø³ÌÍ£µô£º
mysqladmin -u root -p shutdown
3¡¢°Ñ/var/lib/mysqlÕû¸öĿ¼ÒƵ½/home/data
mv /var/lib/mysql /home/data/
ÕâÑù¾Í°ÑMySQLµÄÊý¾ÝÎļþÒƶ¯µ½ÁË/home/data/mysqlÏÂ
4¡¢ÕÒµ½my.cnfÅäÖÃÎļþ
Èç¹û/etc/Ŀ¼ÏÂûÓÐmy.cnfÅäÖÃÎļþ£¬Çëµ½/usr/share/mysql/ÏÂÕÒµ½*.cnfÎļþ£¬¿½±´ÆäÖÐÒ»¸öµ½/etc/Ŀ¼Ï²¢¸ÄÃûΪmy.cnf¡£ÃüÁîÈçÏ£º
[root@test1 mysql]# cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
5¡¢±à¼MySQLµÄÅäÖÃÎļþ/etc/my.cnf
Ϊ±£Ö¤MySQLÄܹ»Õý³£¹¤×÷£¬ÐèÒªÖ¸Ã÷mysql.sockÎļþµÄ²úÉúλÖᣠÐÞ¸Äsocket=/var/lib/mysql/mysql.sockÒ»ÐÐÖеȺÅÓұߵÄֵΪ£º/home/mysql/mysql.sock ¡£²Ù×÷ÈçÏ£º
vi my.cnf (ÓÃvi¹¤¾ß±à¼my.cnfÎļþ£¬ÕÒµ½ÏÂÁÐÊý¾ÝÐÞ¸ÄÖ®)
# The MySQL server
[mysqld]
port = 3306
#socket = /var/lib/mysql/mysql.sock£¨ÔÄÚÈÝ£¬ÎªÁ˸üÎÈÍ×ÓÓ#”×¢ÊÍ´ËÐУ©
socket = /home/data/mysql/mysql.sock £¨¼ÓÉÏ´ËÐУ©
6¡¢ÐÞ¸ÄMySQLÆô¶¯½Å±¾/etc/rc.d/init.d/mysql
×îºó£¬ÐèÒªÐÞ¸ÄMySQLÆô¶¯½Å±¾/etc/rc.d/init.d/mysql£¬°ÑÆäÖÐdatadir=/var/lib/mysqlÒ»ÐÐÖУ¬µÈºÅÓұߵÄ·¾¶¸Ä³ÉÄãÏÖÔÚµÄʵ¼Ê´æ·Å·¾¶£º/home/data/mysql¡£
[root@test1 etc]# vi /etc/rc.d/init.d/mysql
#datadir=/var/lib/mysql £¨×¢ÊÍ´ËÐУ©
datadir=/home/data/mysql £¨¼ÓÉÏ´ËÐУ©
7¡¢ÖØÐÂÆô¶¯MySQL·þÎñ
/etc/rc.d/init.d/mysql start
»òÓÃrebootÃüÁîÖØÆôLinux ¡£
Èç¹û¹¤×÷Õý³£Òƶ¯¾Í³É¹¦ÁË£¬·ñÔò¶ÔÕÕÇ°ÃæµÄ7²½ÔÙ¼ì²éһϡ£
Ïà¹ØÎĵµ£º
Ò»¡¢³£ÓÃ×Ö·û´®º¯Êý
1.CONCAT(str1,str2,...)
mysql> ? concat;
mysql> SELECT CONCAT('My', 'S', 'QL');
+-------------------------+
| CONCAT('My', 'S', 'QL') |
+-------------------------+
| MySQL ......
http://javeye.javaeye.com/blog/558093
ÎÒÃÇÖªµÀ£¬group by¿ÉÒÔ½«sql²éѯ½á¹û°´ÕÕgroup byºóÃæÁнøÐзÖÀàÏÔʾ¡£±ÈÈ磺
Sql´úÂë
select
columnA,columnB
from
table
group
by
columnA,columnB
select columnA,columnB from table group by columnA,colum ......
http://www.3d308.cn/article.asp?id=37
shell> mysql -u root mysql
mysql> Update user SET Password=PASSWORD('new_password')
Where user='root';
mysql> FLUSH PRIVILEGES;
......
ÐÞ¸Ä /etc/mysql/my.cnf Îļþ£¬
ÔÚ £Ûclient£Ý ϼÓÈë default-character-set=utf8,
ÔÚ [mysqld] ϼÓÈë default-character-set=utf8,
ÔòÔÚviÀï¿ÉÒÔÕýÈ·µÄÏÔʾÖÐÎÄÁË£¨Ç°ÌáÊÇviҲʹÓÃutf8£©¡£
²»¹ýÔÚ²éѯµÄʱºò£¬½á¹ûÀïµÄÖÐÎÄÈ´»áÏÔʾ³É "?"£¬Õâ¸öÎÊÌâ±È½Ï¼òµ¥µÄ·½·¨Óм¸ÖÖ£¬·Ö±ðÊÇ£º
1.ÔÚ´´½¨Ê ......
MySQLĬÈÏûÓÐÃÜÂ룬°²×°Íê±ÏÔö¼ÓÃÜÂëµÄÖØÒªÐÔÊDz»ÑÔ¶øÓ÷µÄ¡£
£¨1£©ÃüÁî
/usr/bin/mysqladmin -u root –p ‘old-password’ password 'new-password'
¸ñʽ£ºmysqladmin -uÓû§Ãû -p¾ÉÃÜÂë password ÐÂÃÜÂë
£ ......