Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

MySQL Óû§¹ÜÀí

Ê×ÏÈÒªÉùÃ÷һϣºÒ»°ãÇé¿öÏ£¬ÐÞ¸ÄMySQLÃÜÂ룬ÊÚȨ£¬ÊÇÐèÒªÓÐmysqlÀïµÄrootȨÏ޵ġ£
²âÊÔ»·¾³£ºWIN32 mysql5.0.45
×¢£º±¾²Ù×÷ÊÇÔÚWINÃüÁîÌáʾ·ûÏ£¬phpMyAdminͬÑùÊÊÓá£
    Óû§£ºphplamp  Óû§Êý¾Ý¿â£ºphplampDB
1.н¨Óû§¡£
//怬MYSQL
@>mysql -u root -p
@>ÃÜÂë
//´´½¨Óû§
mysql> insert into mysql.user(Host,User,Password) values("localhost","phplamp",password("1234"));
//Ë¢ÐÂϵͳȨÏÞ±í
mysql>flush privileges;
ÕâÑù¾Í´´½¨ÁËÒ»¸öÃûΪ£ºphplamp  ÃÜÂëΪ£º1234  µÄÓû§¡£
È»ºóµÇ¼һÏ¡£
mysql>exit;
@>mysql -u phplamp -p
@>ÊäÈëÃÜÂë
mysql>µÇ¼³É¹¦
2.ΪÓû§ÊÚȨ¡£
//µÇ¼MYSQL£¨ÓÐROOTȨÏÞ£©¡£ÎÒÀïÎÒÒÔROOTÉí·ÝµÇ¼.
@>mysql -u root -p
@>ÃÜÂë
//Ê×ÏÈΪÓû§´´½¨Ò»¸öÊý¾Ý¿â(phplampDB)
mysql>create database phplampDB;
//ÊÚȨphplampÓû§ÓµÓÐphplampÊý¾Ý¿âµÄËùÓÐȨÏÞ¡£
>grant all privileges on phplampDB.* to phplamp@localhost identified by '1234';
//Ë¢ÐÂϵͳȨÏÞ±í
mysql>flush privileges;
mysql>ÆäËü²Ù×÷
/*
Èç¹ûÏëÖ¸¶¨²¿·ÖȨÏÞ¸øÒ»Óû§£¬¿ÉÒÔÕâÑùÀ´Ð´:
mysql>grant select,update on phplampDB.* to phplamp@localhost identified by '1234';
//Ë¢ÐÂϵͳȨÏÞ±í¡£
mysql>flush privileges;
*/
3.ɾ³ýÓû§¡£
@>mysql -u root -p
@>ÃÜÂë
mysql>DELETE from user WHERE User="phplamp" and Host="localhost";
mysql>flush privileges;
//ɾ³ýÓû§µÄÊý¾Ý¿â
mysql>drop database phplampDB;
4.ÐÞ¸ÄÖ¸¶¨Óû§ÃÜÂë¡£
@>mysql -u root -p
@>ÃÜÂë
mysql>update mysql.user set password=password('ÐÂÃÜÂë') where User="phplamp" and Host="localhost";
mysql>flush privileges;


Ïà¹ØÎĵµ£º

mysqlÔÚcmdϵÄһЩÓï¾ä

ÉèÖÃ×ֶεÄĬÈÏÖµ£º
    ´´½¨±íµÄʱºò£ºcreate table
tablename(columnname columntype default
defaultvalue);
    Ð޸ıíµÄʱºò£ºalter table
tablename alter column
columnname set 
default
deflaultvalue; ......

phpÁ¬½Ómysql²âÊÔºÍÅäÖÃ


phpÁ¬½Ómysql²âÊÔ´úÂ룺
$link=mysql_connect('localhost','root','123456');
if(!$link) echo "ʧ°Ü!";
else echo "³É¹¦!";
mysql_close();
?>
ÔËÐдúÂë³öÏÖ£ºCall   to   undefined   function   'mysql_connect()'… ʧ°Ü
°Ù¶ÈÕÒµ½½á¹ûÊÇPHP+MYSQL »·¾³Ã ......

Õýȷɾ³ýMYSQlÈÕÖ¾·½·¨

1.²éÕÒµ±
mysql> show binary logs;
+—————-+———–+
| Log_name | File_size |
+—————-+———–+
| mysql-bin.000001 | 150462942 |
| mysql-bin.000002 | 125 |
| mysql-bin.000003 | 106 |
+&mdash ......

MySQL Master Slave Replication

MySQL±¾ÉíûÓÐÌṩreplication failoverµÄ½â¾ö·½°¸(¼ûHow can I use replication to provide redundancy or high availability?)
ÈçºÎʹReplication·½°¸¾ßÓÐHA£¿
´ð°¸ÊÇMMM(MySQL Master-Master Replication Manager)
MMM¶ÔMySQL Master-Slave Replication¾ø¶ÔÊÇÒ»¸öºÜÓÐÒæµÄ²¹³ä!
ÒýÑÔ
Master-SlaveµÄÊý¾Ý¿â»ú¹¹ ......

½â¾öÖÐÎÄ´æÈëMySql³öÏÖÂÒÂëÎÊÌâ

½â¾ö°ì·¨£ºÔÚÁ¬½Ó×Ö·û´®ÖÐ˵Ã÷Á¬½Ó×Ö·ûµÄÊôÐÔ£¬È磺
    <add name="server_mysql" connectionString="server=127.0.0.1;user id=root; password=123; database=baiduemail; pooling=false;charset=gbk"/>
»òÕßÊÇ;charset=gb2312
ÁíÍâ×¢Ò⣺ÔÚ´´½¨mysqlÊý¾Ý¿âµÄ±íµÄʱºòÑ¡Ôñ±àÂ뼯gbk ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ