MYSQL³£ÓÃÃüÁîÁбí
MYSQL³£ÓÃÃüÁîÁбí
1¡¢ÏµÍ³¹ÜÀí
mysql -hÖ÷»úµØÖ· -uÓû§Ãû -p
Á¬½ÓMYSQL£¨ÔÚmysql/bin£©
exit
Í˳öMYSQLÃüÁî
mysqladmin -uÓû§Ãû -p¾ÉÃÜÂë passwordÐÂÃÜÂë
ÐÞ¸ÄÃÜÂ루ÔÚmysql/bin£©
grantselect[insert][,update][,delete]onÊý¾Ý¿â.*toÓû§Ãû@localhost£¨"%"£¬ ±íʾÈκÎÖ÷»ú£©identifiedby "ÃÜÂë"
Ôö¼ÓÓû§
mysqldump –u root –p optÊý¾Ý¿âÃû>±¸·ÝÎļþÃû
±¸·ÝÊý¾Ý¿â£¨ÔÚmysql/bin£©
mysql –u root –p < batch file £¨ÀýÈ籸·ÝÎļþÃû£©
ʹÓÃÅú´¦Àí
mysql.server start
Æô¶¯·þÎñÆ÷
mysql.server stop
Í£Ö¹·þÎñÆ÷
msql.server log
2¡¢²éѯÃüÁî
select version()
²éѯ°æ±¾ºÅ
select current_date
²éѯµ±Ç°ÈÕÆÚ
3¡¢ÏÔʾÃüÁî
show databases
ÏÔʾÊý¾Ý¿âÁбí
show tables ÏÔʾ¿âÖеÄÊý¾Ý±í
describe ±íÃû ÏÔʾÊý¾Ý±íµÄ½á¹¹
select * from ±íÃû ÏÔʾ±íÖеļǼ
select what_to_select from which table [whereconditions_to_satisfy and (or) where conditions_to_satisfy] ´ÓÒ»¸ö±íÖмìË÷Êý¾Ý¡ºÂú×ãÌõ¼þ¡»
select ×Ö¶Î1,×Ö¶Î2,… from ±íÃû ÏÔʾÌض¨ÁеÄÖµ
select * from ±íÃû order by ×Ö¶ÎÃû ÅÅÐòÐÐ
select ×Ö¶Î1,°üº¬×Ö¶Î2µÄÔËËãʽas ÐÂ×ֶΠfrom ±íÃû ×Ö¶ÎÖµÔËËã²Ù×÷
select ×Ö¶Î1 is null£¨is not null£© ¿ÕÖµ²Ù×÷
Select*from±íÃûwhere×Ö¶ÎÃûlike£¨not like£© “ ×Ö·û”
×¢£º ÔÊÐíʹÓÓ_”Æ¥ÅäÈκε¥¸ö×Ö·û£¬ ¶ø“£¥” Æ¥ÅäÈÎÒâÊýÄ¿×Ö·û ģʽƥÅä
Select * from±íÃûwhere×Ö¶ÎÃûregexp£¨not regexp£©»òÕßrlike£¨not rlike£© “.”Æ¥ÅäÈκε¥¸öµÄ×Ö·û Ò»¸ö×Ö·ûÀà[…]Æ¥Åä·½¿òÄÚÈκÎ×Ö·û¡£ÀýÈç[a]£¬[asd]£¬[az] Æ¥ÅäÈκÎСд×Öĸ£¬[09] Æ¥ÅäÈκÎÊý
×Ö¡£ “*”Æ¥ÅäÁã¸ö»òÕ߶à¸öÔÚËüÇ°ÃæµÄ¶«Î÷¡£ ÕýÔò±í´ïʽÇø·Ö´óСд[aA] ¡£ Èç¹ûËü³öÏÖÔÚ±»²âÊÔÖµµÄÈκεط½£¬Ä£Ê½¶¼Æ¥Åä¡£ ¶¨Î»£¬ÔÚģʽ¿ªÊ¼´¦ÓÓ^”£¬½áβ´¦ÓÓ$”£¬ÀýÈç“^b”
À©Õ¹ÕýÔò±í´ïʽ
Select count(*) from ±íÃû
Select ×Ö¶ÎÃû£¬count(*) from ±íÃû group by ×Ö¶ÎÃû ÐмÆÊý
4¡¢±à¼ÃüÁî
use database ¿âÃû
ʹÓõÄÊý¾Ý¿â
create database ¿âÃû
´´½¨Êý¾Ý¿â
create table ±íÃû
ÔÚÊý¾Ý¿âÖд´½¨±í
ins
Ïà¹ØÎĵµ£º
mysql error number 2003
Can't connect to MySQL server xxx.xxx.xxx.xxx (10061)
ÔÚubuntu 9.04ÖÐĬÈÏ°²×°ÁËmysql£¬Ä¬ÈÏÖ»Äܱ¾µØ·ÃÎÊ£¬googleÁËһϣº
²ÉÓÃ
µÇ¼µ½MySQL·þÎñÆ÷¶Ë£¬ÔÚmysql¿âÏÂÖ´ÐÐ
grant all on *.* to 'remote'@'172.16.21.39' identified by 'password';
¼´¿É
Èç¹ûÒªÉèÖÃÎ ......
mysql×Ö·û¼¯²é¿´ÒÔ¼°ÐÞ¸Ä
http://blog.csdn.net/cs870101/archive/2009/09/23/4580879.aspx
ת×Ô:http://blog.chinaunix.net/u2/85344/showart_2042280.html
LiunxÏÂÐÞ¸ÄMySQL×Ö·û¼¯£º
1.²éÕÒMySQLµÄcnfÎļþµÄλÖÃ
find / -iname '*.cnf' -print
/usr/share/mysql/my-innodb-heavy-4G.cnf
/usr/share/mysql/my-la ......
¾³£ÔÚÒ»¸ö±íÖÐÓи¸×Ó¹ØϵµÄÁ½¸ö×ֶΣ¬±ÈÈçempnoÓëmanager£¬ÕâÖֽṹÖÐÐèÒªÓõ½Ê÷µÄ±éÀú¡£ÔÚOracle ÖпÉÒÔʹÓÃconnect by¼òµ¥½â¾öÎÊÌ⣬²Î¼ûhttp://blog.csdn.net/ylqmf/archive/2010/01/11/5172866.aspx£¬µ«MySQL 5.1Öл¹²»Ö§³Ö£¨¾Ý˵ÒÑÄÉÈëto doÖУ©£¬Òª×Ô¼ºÐ´¹ý³Ì»òº¯ÊýÀ´ÊµÏÖ¡£
Ò»¡¢½¨Á¢²âÊÔ±íºÍÊý¾Ý£º
view plaincop ......
mysqlÆô¶¯ºÍ¹Ø±ÕÔ¼ÊøµÄ·½·¨(FOREIGN_KEY_CHECKS)
2009-07-06 16:43
MySQL»¹ÔÊý¾Ý¿â£¬½ûÓúÍÆôÓÃÍâ¼üÔ¼ÊøµÄ·½·¨(FOREIGN_KEY_CHECKS)
ÓÐʱ»¹ÔÊý¾Ý¿âʱ£¬ÒòΪ±íÓÐÔ¼Êøµ¼ÖÂ40014´íÎ󣬿ÉÒÔͨ¹ý¹Ø±ÕÍâ¼üÔ¼Êø£¬»¹Ô³É¹¦Ê±ÔÙÆôÓÃ
½ûÓÃ
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0
ÆôÓÃ
S ......
mysqlÖÐchar¡¢varchar¡¢nvarcharÊý¾ÝÀàÐ͵ÄÓ÷¨Çø±ð:
˵Ã÷:
1¡¢char:
¹Ì¶¨³¤¶ÈµÄ·Ç Unicode ×Ö·ûÊý¾Ý£¬×î´ó³¤¶ÈΪ 8,000 ¸ö×Ö·û¡£
2¡¢varchar£º
¿É±ä³¤¶ÈµÄ·Ç Unicode Êý¾Ý£¬×Ϊ 8,000 ¸ö×Ö·û¡£
3¡¢nvarchar£º
¿É±ä³¤¶È Unicode Êý¾Ý£¬Æä×î´ó³¤¶ÈΪ 4,000 ×Ö·û¡£  ......