mysql ÃüÁî
1¡¢MySQL³£ÓÃÃüÁî
create database name; ´´½¨Êý¾Ý¿â
use databasename; Ñ¡ÔñÊý¾Ý¿â
drop database name Ö±½Óɾ³ýÊý¾Ý¿â£¬²»ÌáÐÑ
show tables; ÏÔʾ±í
describe tablename; ±íµÄÏêϸÃèÊö
select ÖмÓÉÏdistinctÈ¥³ýÖظ´×Ö¶Î
mysqladmin drop databasename ɾ³ýÊý¾Ý¿âÇ°£¬ÓÐÌáʾ¡£
ÏÔʾµ±Ç°mysql°æ±¾ºÍµ±Ç°ÈÕÆÚ
select version(),current_date;
2¡¢ÐÞ¸ÄmysqlÖÐrootµÄÃÜÂ룺
shell>mysql -u root -p
mysql> update user set password=password(”xueok654123″) where user=’root’;
mysql> flush privileges //Ë¢ÐÂÊý¾Ý¿â
mysql>use dbname£» ´ò¿ªÊý¾Ý¿â£º
mysql>show databases; ÏÔʾËùÓÐÊý¾Ý¿â
mysql>show tables; ÏÔʾÊý¾Ý¿âmysqlÖÐËùÓÐµÄ±í£ºÏÈuse mysql£»È»ºó
mysql>describe user; ÏÔʾ±ímysqlÊý¾Ý¿âÖÐuser±íµÄÁÐÐÅÏ¢£©£»
3¡¢grant
´´½¨Ò»¸ö¿ÉÒÔ´ÓÈκεط½Á¬½Ó·þÎñÆ÷µÄÒ»¸öÍêÈ«µÄ³¬¼¶Óû§£¬µ«ÊDZØÐëʹÓÃÒ»¸ö¿ÚÁîsomething×öÕâ¸ö
mysql> grant all privileges on *.* to user@localhost identified by ’something’ with
Ôö¼ÓÐÂÓû§
¸ñʽ£ºgrant select on Êý¾Ý¿â.* to Óû§Ãû@µÇ¼Ö÷»ú identified by “ÃÜÂë”
GRANT ALL PRIVILEGES ON *.* TO monty@localhost IDENTIFIED BY ’something’ WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO monty@”%” IDENTIFIED BY ’something’ WITH GRANT OPTION;
ɾ³ýÊÚȨ£º
mysql> revoke all privileges on *.* from root@”%”;
mysql> delete from user where user=”root” and host=”%”;
mysql> flush privileges;
´´½¨Ò»¸öÓû§customÔÚÌض¨¿Í»§¶Ëit363.comµÇ¼£¬¿É·ÃÎÊÌض¨Êý¾Ý¿âfangchandb
mysql >grant select, insert, update, delete, create,drop on fangchandb.* to custom@ it363.com identified by ‘ passwd’
ÖØÃüÃû±í:
mysql > alter table t1 rename t2;
4¡¢mysqldump
±¸·ÝÊý¾Ý¿â
shell> mysqldump -h host -u root -p dbname >dbname_backup.sql
»Ö¸´Êý¾Ý¿â
shell> mysqladmin -h myhost -u root -p create dbname
shell> mysqldump -h host -u root -p dbname < dbname_backup.sql
Èç¹ûÖ»Ïëж³ö½¨±íÖ¸ÁÔòÃüÁîÈç
Ïà¹ØÎĵµ£º
IN expireDate VARCHAR(20),IN resType INT
//-----------------------------------------------------------------------------------
BEGIN
DECLARE a,b,icon_id INT;
DECLARE cur_1 CURSOR FOR SELECT id from `tbl_resource` WHERE discriminator="RC_CON" and robot_type=resType and add_date<=ex ......
±êÌ⣺MySQLº¯Êý´óÈ«
³ö´¦£º¿¡µÄ²©¿Í
ʱ¼ä£ºSat, 14 Mar 2009 14:33:22 +0000
×÷Õߣºhhj
µØÖ·£ºhttp://hhj.gx.cn/post/308/
ÄÚÈÝ£º
lect ASIN('foo');
¡¡¡¡-> 0.000000
ATAN(N)
¡¡·µ»ØNµÄ·´ÕýÇÐÖµ
mysql> select ATAN(2);
¡¡¡¡-> 1.107149
mysql> select ATAN(-2);
¡¡¡¡-> -1.107149
AT ......
ÕªÒª£ºMySQLÊÇÒ»¸ö¸ßËٶȡ¢¸ßÐÔÄÜ¡¢¶àÏ̵߳ĹØϵÐÍÊý¾Ý¿â¹ÜÀíϵͳ£¬ÊÊÓÃƽ̨¶à£¬¿ÉÀ©Õ¹ÐÔÇ¿¡£ÔÚʵ¼ÊÉú²ú»·¾³ÖУ¬²¿ÊðºÍʵÏÖ¾ßÓÐÒ»¶¨¸ºÔؾùºâ¹¦ÄܵÄMySQL·þÎñÆ÷
¼¯Èº£¬¶ÔÓÚÌá¸ßÓû§Êý¾Ý¿âÓ¦ÓÃϵͳµÄÐÔÄÜ¡¢ËٶȺÍÎȶ¨ÐÔ¾ßÓÐÃ÷ÏÔµÄ×÷Óᣱ¾ÎļòÒª½éÉÜÁËÔÚFreeBSD
7.0-ReleaseϵͳÉϲ¿ÊðʵÏÖMySQL·þÎñÆ÷
¼¯ÈºµÄ·½°¸£¬²¢¶Ô¿É ......
MySQL FOR LINUX
Ïȼì²éϵͳÊÇ·ñ×°ÉÏÁËmysql£¬Èç¹ûÓн«ÆäжÔصô
rpm -qa | grep mysql
×¢ÒâmysqlµÄ´óСд£¬´óСд¶¼ÓпÉÄÜ
rpm -e --nodeps mysql*
Ò»¶¨ÒªÓÃ--nodepsжÔØ£¬²»¼ì²éÒÀÀµÐÔ¹Øϵ¡£
´´½¨Óû§mysql
groupadd mysql
useradd -g mysql mysql
passwd mysql
ÔÚ/usr/localϽ¨Á¢ mysql Îļþ¼Ð
È»ºó½«°²×°Î ......