ÕâÁ½Ìì°²×°MYSQLÓöµ½ºÜ¶àÎÊÌ⣬ÕÒÁ˺ܶà²ÄÁÏ£¬°Ñ×ܽáµÄ¶«Î÷д³öÀ´¿´¿´
1¡¢Ê×ÏÈÑ¡ÔñºÏÊ浀 mysql °æ±¾¡£ È¥ http://www.mysql.com
ÏÂ×îеİ汾 mysql
ͬʱһ¸ö°æ±¾·ÖÓв»Í¬µÄ·Ö·¢ÐÎʽ£¬ÓеÄÒÔ rpm °ü£¬ÓеÄÒÔ tar °ü£¬¶øÓеÄÒÔÔ´´úÂëµÄ·½Ê½·¢²¼¡£rpm°ü°²×°·½±ã£¬µ«ÊDz»¹»Áé»î£»Ô´´úÂëºÜÁé»îÈ´ÐèÒª±àÒ룬ËùÒÔÎÒÏÂÔØÁË tar °üÀ´°²×°£¬ÒòΪËü×öÁËÓÅ»¯±àÒë¡£ Ò»°ãtar°üÖ±½Ó½âѹ¾Í¿ÉÒÔʹÓÃÁË£¬µ«ÊÇÏëÆô¶¯ºÍÍ£Ö¹·½±ã»¹ÐèÒªÐÞ¸ÄһЩÁ´½ÓÕâÀï¾Í¶¼Ð´³öÀ´¿©£¡
2¡¢°²×°mysql¡£
rpm°üµÄ°²×°²»ÔÚ׸Êö£¬Ô´´úÂëºÍtar°ü×îºÃ°²×°ÔÚ /usr/local/mysql ÖУ¬Æä·½·¨ÊÇÔ´´úÂë configure ʱºò¼ÓÈë ¡ª¡ªprefix=/usr/loal/mysql£¬¶ø tar °üÖ±½Ó½âѹµ½ /usr/local/mysql ¼´¿É¡£
3¡¢°²×°ºóÅäÖá£
ÔÚ mysql µÄĿ¼Àï(°²×°ºó)ÕÒµ½ /bin/mysql_install_db ²¢ÔËÐУ¬tar °üÔÚ mysql ÖÐµÄ ½Å±¾s Ŀ¼Ï£¬ÕâÑùÊý¾Ý¿â¾Í°²×°ÁË£º
$ cd /usr/local/mysql
$ ./bin/mysql_install_db £¨³õʼ»¯Êý¾Ý¿â£©
Ìí¼Ó×é mysql ºÍÓû§ mysql£¬°ÑÆä³õʼĿ¼ÉèÖõ½ mysql µÄ°²×°Ä¿Â¼À²¢½« mysql ÉèÖÃ³É mysql Îļþ¼ÐµÄËùÓÐÕߣ¬ÕâÑù¿ÉÒÔ·ÀÖ¹²»ÄÜÁ¬½Ó MySql ·þÎñÆ÷´íÎó£º
$ useradd -M -o -r -d /usr/local/mysql -s /bin/bash -c "mysql user" -u 27 mysql
$ cd /usr/local/
$ chmod 750 mysql -R
$ chgrp mysql mysql -R
$ chown mysql mysql -R
Ö´ÐÐ mysql Ŀ¼Àï /bin/mysql_safe£¬tar°üÓиö shell Îļþ½Ð safe_mysql Ò²¿ÉÒÔ£¬ÕâÑù mysql µÄÊØ»¤½ø³Ì¾Í¿ªÊ¼ÔËÐУº
$ /usr/local/mysql/bin/safe_mysqld &
²é¿´ÍøÂçµÄ3306¶Ë¿ÚÇé¿ö£¬À´ÅÐ¶Ï mysql ÊÇ·ñÕý³£µÄÔËÐÐÁË£º
$ netstat -atln
Èç¹ûûÓÐÕý³£ÔËÐУ¬µ½ data Ŀ¼Ï²鿴ÈÕÖ¾Îļþ²éÕÒ´íÎó¡£
ΪÁË·½±ãÆڼ䣬ÎÒÃǽ¨Á¢¼¸¸öÁ´½ÓÎļþµ½ /sbinÖУ¬ÒÔÃâÿ´ÎÒªµ½ mysql ÖÐÔËÐгÌÐò£º
$ ln -s /usr/local/mysql/bin/mysql /sbin/mysql
$ ln -s /usr/local/mysql/bin/mysqladmin /sbin/mysqladmin
½«ÊØ»¤½ø³Ì½Å±¾¸´ÖƵ½³õʼ»¯Ä¿Â¼ÖУ¬²¢¼ÓÈëµ½×Ô¶¯Æô¶¯ÁбíÖУº
$ cd mysql
$ cp support-files/mysql.server /etc/rc.d/init.d/mysqld
$ÐÞ¸ÄmysqldÖÐµÄ pid_fileµÄĿ¼£¡µ±È»£¬Ä¿Â¼ËæÒâ×îºÃÊǺÍÒѾÆô¶¯µÄPIDĿ¼һÖÂ
$ chkconfig ¡ª¡ªadd mysqld
$ chkconfig ¡ª¡ªlevel 345 mysqld on
ÑéÖ¤ÉÏÊö²Ù×÷µÄÕýÈ·ÐÔ£¬ÔËÐУº
$ /etc/rc.d/init.d/mysqld restart
»òÕß:
$ service mysqld restart
4¡¢mysqlµÄ°²È«ÉèÖÃ
ÔËÐÐÏÂÃæÖ¸ÁÇå³ý¿ÕÃÜÂëÕÊ»§£º
$ mysqladmin -uroot password "youpassword" #ÉèÖÃrootÕÊ»§µÄÃÜÂë
$ mysql -uroot -p
mysql>use mysql;
mysql>delete from user where password=""; #ɾ³ýÓÃÓÚ±¾»úÄäÃûÁ¬½ÓµÄ¿ÕÃÜÂëÕʺÅ
mysql>flush privileges;
mysql>quit
×îºóÀ´¸ö²âÊÔ£¬²»¹ýÏÈÇл»µ½ mysql Ï msql-benmak Ŀ¼£º
$ perl run-all-tests ¡ª¡ªuser=root ¡ª¡ªpassword="new"
ΪÁËд³ÌÐò·ÃÎÊ mysql Êý¾Ý¿â£¬Ó¦ÔÚ /usr/include ºÍ /usr/lib Öн¨Á¢Á´½Óµ½ mysql µÄ include ºÍ lib Ŀ¼ÖУ¬ÕâÑùÖ»ÒªÔÚ³ÌÐòÖмÓÈë #include ¾Í¿ÉÒÔÒýÓà mysql µÄÍ·Îļþ¡£
ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
ÆäÖеÄ·¾¶¼°Îļþ¡¢Îļþ¼ÐÃû¸ù¾ÝÄãµÄÇé¿ö½øÐÐÏàÓ¦Ð޸ģ¬ÀýÈçÎÒÓÃµÄ tar °üÖÐ include Ŀ¼ÏÂûÓÐ mysql Õâ¸öÎļþ¼Ð£¬Ö»ÓкܶàµÄÍ·Îļþ£¬ËùÒÔÎÒµÄÊÇÕâÑùдµÄ£º
ln -s /usr/local/mysql/lib /usr/lib/mysql
ln -s /usr/local/mysql/include /usr/include/mysql
µ«ÎÞÂÛÈçºÎÖ»ÒªËüµÄÍ·ÎļþÄÜÕý³£µÄÒýÓþͿÉÒÔÁË¡£
ÓеÄÊÇ¿ÉÒÔÁé»î±äͨµÄ£¬²»¿¼ÂÇÆäËûµÄÒòËصÄʱºò£¬ÄãµÄmysqlÍêÈ«¿ÉÒÔ°²×°µ½rootĿ¼ÖУ¬µ«ÊÇÒ»°ã´ó¼Ò¶¼·Åµ½ /usr/local/mysql Õâ¸öĿ¼ÖС£
4¡¢perlÄ£¿éµÄ°²×°
ºÜ¶àµÄÍøÒ³»¹ÊÇÓà perl£¬ÎªÁËÄÜÓà perl ÓïÑÔ·ÃÎÊ mysql£¬Í¬Ê±ÄÜÔËÐÐ mysql ¸½´øµÄ²âÊÔ³ÌÐò£¬ÎÒ°²×°ÁËһЩ perl µÄÄ£¿é¡£
¶Ô´Ë£¬Ëµ·¨²»Ò»£¬ÆäʵÄã²»°²×°ÒµÎ޿ɺñ·Ç£¬ÓеÄÓà php ×÷ web ¾Í²»ÐèÒªÁË£¬ÏñÎÒÖ»ÊÇдӦÓóÌÐò·ÃÎÊ mysql Ò²ÊDz»ÐèÒª°²×°µÄ£¬µ«ÊÇÎÒ°²×°ÁË£¬Ö»ÊÇΪÁËÄܲâÊÔ mysql¡£
ÎÒ°²×°µÄÄ£¿éÓУº
Data-Dumper-2.121
Data-ShowTable-3.3
DBD-mysql-2.9003
DBI-1.42
Msql-Mysql-modules-1.2219
Net-MySQL-0.08
mysql ÊÖ²áÍƼö Data-Dumper + Data-ShowTable + DBI + Msql-Mysql-modules£¬ÕâÑùDBI¾Í°²×°³É¹¦ÁË¡£µ«ÊÇ mysql ÍøÕ¾ÉÏÍƼöµÄ DBI Ä£¿éÖÐÖ»ÓÐ DBI + Net-MySQL + DBD-mysql Èý¸öÄ£¿é£¬ÎÒ¶Ô perl ²»ÊìϤ£¬Ò²²»ÖªµÀÕâÑùµÄ pm Îļþµ½µ×Óô¦ÊÇʲô£¬µ«ÊÇÓÐÒ»µãÊǿ϶¨µÄ£¬°²×°ÕâÑùÄ£¿éÊÇûÓÐÈκεĻµ´¦µÄ¡£
°²×°¹ý³ÌÖÐ Data-ShowTable 724ÐдúÂë³öÏÖ´íÎó£¬Ã÷ÏÔµÄÉÙÁËÁ½¸ö ">"£¬DBD-mysql±àÒëÒ²³öÏÖ´íÎó£¬ÔÒòÊÇ·¾¶²»¶Ô£¬Ã»ÓÐÕÒµ½Îļþ mysql-config £¬°ÑÄãµÄ·¾¶¼ÓÈë½øÈ¥±àÒë¾Í¿ÉÒÔ¡£
ÆäËûµÄ±àÒ붼°´ÕÕ readme ÉÏÈ¥×ö¾Í¿ÉÒÔÁË¡£
5¡¢¹ÜÀí¹¤¾ß
°²×°Íê±Ïºó£¬Äã¾Í¿ÉÒÔÔÚÊý¾Ý¿âÖмÓÈë×Ô¼ºµÄ¶«Î÷ÁË¡£
»¹ÓÃÃüÁîÐУ¿·´ÕýÎÒÊÇÍ·´óµÄ£¬ÎÒ¾õµÃÖ»ÒªÄ㶮¾Í¿ÉÒÔÁË£¬ÖÁÓÚʵ¼ÊµÄÓ¦ÓþͿÉÒÔÓÃһЩ GUI ºÃµãµÄ¹¤¾ß£¬±Ï¾¹³ÌÐòÔ±µÄÌìÖ°¾ÍÊÇÈüÆËã»ú¸üÌù½üÈË¡£Òª²»ËûÃǸÉÂïµÄ£¿
ÖÁÓÚmysql¹ÜÀí¹¤¾ßÎÒÍƼömysqlcc£¬Ê®·ÖºÃÓã¬ËäÈ»ÓÐЩµØ·½ÓÃÆðÀ´²»Êæ·þ£¬²»¹ýÓÐÐËȤµÄ»°Äã×Ô¼º¸ÄÒ»ÏÂÒ²¿ÉÒÔ£¬±Ï¾¹ÕâÊÇ¿ªÔ´µÄÓÅÊÆÂï¡£
ÔÚ /usr/bin Öн¨Á¢Ò»¸öÈíÁ¬½Ó£º
ln -s /usr/local/mysqlcc/mysqlcc /usr/bin/mysqlcc
ÄÇô£¬Use it anywhere£¡
6¡¢Ìí¼ÓÔ¶³ÌÓû§
ΪÁËÄÜÈÃÔ¶³ÌµÄÓû§·ÃÎÊÊý¾Ý¿â£¬»¹ÒªÌí¼ÓÔ¶³ÌÓû§¡£
$ mysql -p
Enter password:*****
mysql>use mysql
mysql>grant all privileges on *.* to test@"192.168.0.%" identified by "test" with grant option;
mysql>quit;
ÕâÑù¾Í½¨Á¢ÁËÒ»¸ö³¬¼¶Óû§ test£¬¿ÉÒÔÔÚ±¾µØ¾ÖÓòÍøµÄÈκεط½Á¬½Ó£¬È¨Ï޺ܴóµ«ÃÜÂëºÜÈõÖÇ£¬ÎÒÃDz»ÏëÕâÑù£¬µ«ÊÇ´Ëʱ£¬Óû§µÄȨÏÞÒѾ¿ªÊ¼ÉúЧÁË¡£
Èç¹ûÄãÊÖ¹¤ÐÞ¸ÄÊÚȨ±í£¬Òª£º
mysql>FLUSH PRIVILEGES;
»òÕß
$ mysqladmin flush-privileges -p
´ËÍ⣬ȫ¾ÖȨÏ޵ĸıäºÍ¿ÚÁî¸Ä±äÔÚÏÂÒ»´Î¿Í»§Á¬½ÓʱÉúЧ£¬±íºÍÁÐȨÏÞÔÚ¿Í»§µÄÏÂÒ»´ÎÇëÇóʱÉúЧ£¬Êý¾Ý¿âȨÏ޸ıäÔÚÏÂÒ»¸ö USE db_name ÃüÁîÉúЧ¡£
Óà mysqlcc ÐÞ¸Ä test Óû§µÄȨÏÞ£¬ÓÉÓÚÎÒ²»ÏëÈÃÕâ¸öÓû§ÆÆ»µÎÒµÄÊý¾Ý£¬ËùÒÔÔÚ user ±íÖС£
online0066 ÓÚ 2009-04-27 11:24:02·¢±í:
ºÜÏêϸ£¬°²×°µÄÅäÖÃÇåµ¥»ù±¾¸úÎÒÃÇÀÏʦ½²µÄ²î²»¶à
you_me ÓÚ 2009-01-12 21:21:28·¢±í:
ºÜºÃ£¬¿ÉÒÔѧϰ
yu3312282 ÓÚ 2009-01-12 19:08:07·¢±í:
ºÜÏêϸ£¬Ö§³ÖÏÂ
cxczqfrx ÓÚ 2008-09-10 21:47:51·¢±í:
(q):s
½éÉܵıȽÏÏêϸ