mysqlÃÜÂë
MYSQL ÐÞ¸ÄrootÃÜÂëÃüÁî
cmdÏÂÇл»µ½ mysql °²×°Ä¿Â¼
Àý
d:/mysql/bin
ǰÌ᣺mysqlÓû§rootÃÜÂëΪ¿Õ.
ÊäÈë mysql -u root mysql
mysql> ״̬ÏÂÊäÈë update user set password=password('ÐÂÃÜÂë') where user='root';
»ØÏÔ
Query OK, 0 rows affected (0.00 sec)
Rows matched: 2 Changed: 0 Warnings: 0
mysql> ״̬ÏÂÊäÈë FLUSH PRIVILEGES;
»ØÏÔ
Query OK, 0 rows affected (0.00 sec)
mysql> ״̬ÏÂÊäÈë quit
Í˳ö sql
×¢Òâÿ¸öÃüÁîºó¶¼Òª¼ÓÉÏÒ»¸ö·ÖºÅ ";"
mysql ²Å¿ªÊ¼Ö´ÐиÃÐÐÃüÁî
¶øµÚ¶þ¸öÖ¸Áî»áÈÃÒÑÔØÈë¼ÇÒäÌåµÄ mysql ϵͳ×ÊÁÏ¿â¸üÐÂ
ÖØÆð mysql .
ÔÚ¸üРroot ÃÜÂëáᣬÈÕááÒªÓë MySQL Á¬Ïߵķ½·¨Îª£º
mysql -uroot -pÐÂÃÜÂë
==================================================
Íü¼Çmysql µÄroot ÃÜÂ룺
ÏÈÈ·ÈÏÒѾɱµômysqld ½ø³ÌÁË£¬È»ºóÖ´ÐÐÕâ¸ö
/usr/bin/safe_mysqld --skip-grant-tables &
ÔÙÕâÑùµÇ¼
mysql -h 192.168.1.2 -u root
ÉϱߵÄ192.168.1.2 ÊÇcloud µÄmysqld ÔËÐлúÆ÷£¬Äã»»³É×Ô¼ºµÄ£¬ÕâÑùµÇ¼ÉÏ
È¥£¬¾Í¿ÉÒÔÐÞ¸ÄÃÜÂëÁË¡£
ÐÞ¸ÄÃÜÂë
1.mysql -h hostname –u root ÃüÁîµÇ¼µ½mysqld server ÓÃgrant ÃüÁî¸Ä±ä¿ÚÁî:
Grant all on *.* to root indentified by "111111"
2. mysqladmin -u Óû§Ãû-p ¾ÉÃÜÂëpassword ÐÂÃÜÂë
Àý1£º¸øroot ¼Ó¸öÃÜÂëab12¡£Ê×ÏÈÔÚDOS ϽøÈëĿ¼mysqlbin£¬È»ºó¼üÈë
ÒÔÏÂÃüÁî
mysqladmin -uroot password ab12
×¢£ºÒòΪ¿ªÊ¼Ê±root ûÓÐÃÜÂ룬ËùÒÔ-p ¾ÉÃÜÂëÒ»Ïî¾Í¿ÉÒÔÊ¡ÂÔÁË¡£
2¡¢Àý2£ºÔÙ½«root µÄÃÜÂë¸ÄΪdjg345¡£
mysqladmin –u root -pab12 password djg345 (×¢Òâ-p ²»ÒªºÍºóÃæµÄÃÜÂë·Ö
¿ªÐ´£¬ÒªÐ´ÔÚÒ»Æð)
3.
use mysql; update user set password =password('yourpass') where user='r
oot'
4. ÔØÈëȨÏÞ±í£º `mysqladmin -h hostname flush-privileges' £¬»òÕßʹ
ÓÃSQL ÃüÁî`FLUSH PRIVILEGES'¡££¨µ±È»£¬ÔÚÕâÀÄãÒ²¿ÉÒÔÖØÆômysqld¡££©
mysql µÄ½¨¿â£¬Ìí¼ÓÊý¾Ý·½·¨£º
mysqi –u root
mysql>create database ttt;
mysql>source 1.txt
mysql>load data local infile "2.txt" into table board;
1.txt ÄÚÈÝ:
CREATE TABLE board (
boardid int(11) NOT NULL auto_increment,
boardname char(255),
PRIMARY KEY (boardid)
);
Ïà¹ØÎĵµ£º
ÏÈ˵Ã÷Ò»ÏÂBlobµÄÀàÐÍ£¬Ö±½Ó´ÓÍøÉÏÕª³ÁË£¡£¡£¡
1¡¢MySQLÓÐËÄÖÖBLOBÀàÐÍ:
¡¡¡¡·tinyblob:½ö255¸ö×Ö·û
¡¡¡¡·blob:×î´óÏÞÖÆµ½65K×Ö½Ú
¡¡¡¡·mediumblob:ÏÞÖÆµ½16M×Ö½Ú
¡¡¡¡·longblob:¿É´ï4GB
2¡¢³ýÁËÀàÐͶԺóÃæ´æÈ¡Îļþ´óСÓÐÏÞÖÆ£¬»¹ÒªÐÞ¸ÄmysqlµÄÅäÖÃÎļþ¡£
¡¡¡¡Windows¡¢linux»ù±¾Ò»Ñù ......
Ê×ÏÈÒªÉùÃ÷һϣºÒ»°ãÇé¿öÏ£¬ÐÞ¸ÄMySQLÃÜÂ룬ÊÚȨ£¬ÊÇÐèÒªÓÐmysqlÀïµÄrootȨÏ޵ġ£
×¢£º±¾²Ù×÷ÊÇÔÚWINÃüÁîÌáʾ·ûÏ£¬phpMyAdminͬÑùÊÊÓá£
Óû§£ºphplamp Óû§Êý¾Ý¿â£ºphplampDB
1.н¨Óû§¡£
//怬MYSQL
@>mysql -u root -p
@>ÃÜÂë
//´´½¨Óû§
mysql> insert into mysql.user ......
DATE_FORMAT(date,format)
¸ù¾Ýformat×Ö·û´®¸ñʽ»¯dateÖµ¡£ÏÂÁÐÐÞÊηû¿ÉÒÔ±»ÓÃÔÚformat×Ö·û´®ÖУº %M ÔÂÃû×Ö(January……December)
%W
ÐÇÆÚÃû×Ö(Sunday……Saturday)
%D ÓÐÓ¢Óïǰ׺µÄÔ·ݵÄÈÕÆÚ(1st, 2nd, 3rd, µÈµÈ¡££©
%Y Äê, Êý×Ö, 4 λ
%y Äê, Êý×Ö, 2 λ
%a ËõдµÄÐÇÆÚÃû×Ö(Sun ......
mysql noinstall°æ°²×°
1¡¢Èí¼þµÄÏÂÔØ
¡¡¡¡µ½mysqlµÄ¹Ù·½ÍøÕ¾ÏÂÔØMySQLµÄ½âѹ°ü£¬Èçmysql-noinstall-5.0.51b-win32.zip
¡¡¡¡È»ºó½«Æä½âѹµ½ÄãÏ£ÍûÊý¾Ý¿âËùÔÚµÄij¸öλÖã¬ÈçC:\
¡¡¡¡ÕâÑùÔÚC:ÅÌÏÂÃæ¾ÍÓÐÁËC:\mysql-5.0.51b-win32ÕâÑùµÄÒ»¸öĿ¼£¬ÀïÃæ¾ÍÊÇMySQLÊý¾Ý¿âµÄÈ«²¿ÄÚÈÝ¡£
2¡¢ÅäÖÃ
¡¡¡¡Ê×ÏÈÎÒÃÇÀ´¿´MySQLµÄ¸ùĿ ......
now()º¯ÊýÒÔ`yyyy-mm-dd hh:mm:ss·µ»Øµ±Ç°µÄÈÕÆÚʱ¼ä£¬¿ÉÒÔÖ±½Ó´æµ½datetime×Ö¶ÎÖС£
curdate()ÒÔ’yyyy-mm-dd’µÄ¸ñʽ·µ»Ø½ñÌìµÄÈÕÆÚ£¬¿ÉÒÔÖ±½Ó´æµ½date×Ö¶ÎÖС£
curtime()ÒÔ’hh:mm:ss’µÄ¸ñʽ·µ»Øµ±Ç°µÄʱ¼ä£¬¿ÉÒÔÖ±½Ó´æµ½time×Ö¶ÎÖС£ ......