1]ÈçºÎ´´½¨mysqldÊý¾Ý¿âµÄ¹ÜÀíÓû§£¿
Êý¾Ý¿â°²×°ºÃºó£¬ÎÒÃÇÓ¦¸ÃΪmysqlÊý¾Ý¿â´´½¨Ò»¸ö¹ÜÀíÕʺš£Òª°ÑrootÓû§ÉèÖÃΪ¹ÜÀíÔ±£¬ÎÒÃÇÓ¦¸ÃÔËÐÐÏÂÃæµÄÃüÁ
[root@linuxsir01 root]# /opt/mysql/bin/mysqladmin -u root password 123456
[root@linuxsir01 root]#
ͨ¹ýÉÏÃæµÄÃüÁÎÒÃÇ¿ÉÒÔÖªµÀ£¬mysqlÊý¾Ý¿âµÄ¹ÜÀíÔ±ÊÇroot£¬ÃÜÂëÊÇ123456¡£
2]ÈçºÎ½øÈëmysqlÊý¾Ý¿â£¿ÒÔmysqlÊý¾Ý¿â¹ÜÀíÔ±root£¬ÃÜÂëΪ123456ΪÀý£»
[root@linuxsir01 root]#/opt/mysql/bin/mysql -uroot -p123456
Êä³öÉÏÃæµÄÃüÁîºó£¬³öÏÖµÄÊÇÈçϵÄÌáʾ£»
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 3.23.58
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
×¢Ò⣺²Ù×÷ÕâЩÃüÁîµÄʱºò£¬Ó¦¸Ã°Ñmysqld·þÎñÆ÷´ò¿ª¡£ÕâЩÐÂÊÖÐÖµÜÔç¾ÍÖªµÀÁË°É
3]ÈçºÎ²Ù×÷Ò»¸öÊý¾Ý¿âÄØ£¬Õâ¸öÎÊÌâ¾Í±È½Ï¶àÁË£¬½¨Ò黹ÊÇ¿´Ò»ÏÂmysqlµÄÊÖ²á°É¡£ÀïÃæµÄ¶«Î÷Ì«¶àÁË¡£Èç¹û²Ù×÷Ò»¸öÊý¾Ý¿â£¬Ê×ÏÈÊÇÒªÖ¸¶¨Ò»¸öÊý¾Ý¿âΪµ±Ç°Êý¾Ý¿â£¬Ó¦¸ÃÓÃuseÃüÁî
mysql>use [Êý¾Ý¿â];
±ÈÈçÎÒÏëÖ¸¶¨linuxÕâ¸öÊý¾Ý¿âΪµ±Ç°Êý¾Ý¿â£¬Ó¦¸ÃÊÇ
mysql> use linux;
Database changed
mysql>
4]ÈçºÎ±¸·ÝÊý¾Ý¿â£¿
±ÈÈçÎÒÃÇÒª±¸·ÝmysqlÖÐÒѾ´æÔÚµÄÃûΪlinuxµÄÊý¾Ý¿â£¬ÒªÓõ½ÃüÁîmysqldump
ÃüÁî¸ñʽÈçÏ£º
[root@linuxsir01 root]# /opt/mysql/bin/mysqldump -uroot -p linux > /root/linux.sql
Enter password:ÔÚÕâÀïÊäÈëÊý¾Ý¿âµÄÃÜÂë
ͨ¹ýÉÏÃæµÄÃüÁÎÒÃÇÒªÃ÷°×Á½¼þÊ£¬Ê×Ïȱ¸·ÝÊý¾Ý¿âÊÇÒªÒÔÊý¾Ý¿â¹ÜÀíÔ±µÄÉí·Ý±¸·Ý£»Æä´Î£º±¸·ÝÄ¿µÄµØÊÇ/root£¬±¸·ÝµÄÎļþÃûÊÇlinux.sql¡£Æäʵ±¸·ÝµÄλÖúÍÎļþÃû£¬¸ù¾Ý×Ô¼ºµÄÇé¿öÀ´¶¨¡£ÎļþÃû¿ÉÒÔ×Ô¼ºÀ´È¡£¬Â·¾¶Ò²¿ÉÒÔ×Ô¼ºÀ´°²ÅÅ£»
±ÈÈçÎÒÏë°ÑlinuxµÄÊý¾Ý¿â±¸·Ýµ½/home/beinan£¬Êý¾Ý¿âµÄÎļþÃûΪlinuxsir031130.sql£¬ËùÒÔÓ¦¸ÃÊäÈëÈçϵÄÃüÁî¡£
[root@linuxsir01 root]#/opt/mysql/bin/mysqldump -uroot -p linux > /home/beinan/linuxsir031130.sql
Enter password:ÔÚÕâÀïÊäÈëÊý¾Ý¿â¹ÜÀíÔ±rootµÄÊý¾Ý¿âÃÜÂë
ÕâÑùÎÒÃǵ½/home/beinanĿ¼Ï¾ÍÄÜ·¢ÏÖmysqlÖÐÃûΪlinuxµÄÊý¾Ý¿âµÄ±¸·ÝÎļþlinuxsir031130.sql
×ÛÉÏËùÊö£¬ÎÒÃÇѧϰʱҪѧ»á±äͨ¡£
5]ÈçºÎ°Ñ°Ñ±¸·ÝµÄÊý¾Ý¿âµ¼Èëµ½Êý¾Ý¿âÖУ¿
Ê×ÏÈÎÒÃÇ»¹ÊÇÒª²Ù×÷ÉÏÃ漸¸ö¹ý³Ì£¬±ÈÈçÌí¼ÓÊý¾Ý¿â¹ÜÀíÔ±(Èç¹ûÄúûÓÐÌí¼Ó¹ýmysqlÊý¾Ý¿â¹ÜÀíÔ±µÄ»°)£¬´´½¨Êý¾Ý¿âµÈ¡£
±ÈÈçÎÒÃÇÒª°ÑÔÚ/home/beinanÕâ¸öĿ¼ÖеÄlinuxsir031130.sqlÕâ¸ö±¸·Ý£¬µ¼ÈëÃûΪlinuxµÄÊý¾Ý¿âÖУ¬Ó¦¸ÃÈçϲÙ×÷£»
[root@linuxsir01 root]# /opt/mysql/bin/mysql -uroot -p linux < /home/beinan/linuxsir031130.sql
Enter password:ÔÚÕâÀïÊäÈëÃÜÂ룬Èç¹û»úÆ÷ºÃ£¬Êý¾Ý¿â±È½ÏС£¬¼¸·ÖÖӾͺÃÁË¡£
6]ÈçºÎµ¼³öÊý¾Ý¿â±íµÄÊý¾Ý£¿(²»Í¬ÓÚ±¸·ÝŶ)
#mysql
(#mysql>use linux£»)#¿ÉÓпÉÎÞ
#mysql>select * from linux.table-name into outfile "/home/table-name.txt";
#/home/table-name.txt ¿ÉÄܻᱨ´í£¬Èç¹ûÕâÑùÈ¥µô/homeÖ±½Ó"table-name.txt"
ĬÈϱ£´æÔÚ/var/lib/mysql/table-name.txt
6]¶ÔmysqlÊý¾Ý¿â³£ÓÃÃüÁîµÄÒ»µã²¹³ä£»
¼¸¸ö³£ÓõÄmysqlÏà¹ØµÄ¹ÜÀíÃüÁî
mysql ÃüÁ»ù±¾Îı¾µÄ£¬ÏÔʾºÍʹÓõÄmysqlÊý¾Ý¿â¡£Ç°ÃæÒѾ¼òµ¥µÄÌá¹ýÓ÷¨£»±ÈÈçµÇ¼µÈ¡£
mysqladmin ÃüÁÓÃÀ´´´½¨ºÍά»¤mysqlÊý¾Ý¿âµÄÃüÁǰÃæÒѾ¼òµ¥µÄÌá¹ý£»
isamchk ÊÇÓÃÀ´ÐÞ¸´¡¢¼ì²éºÍÓÅ»¯.ismºó׺µÄÊý¾Ý¿âÎļþ£»
mysqldump ÊÇÓÃÓÚ±¸·ÝÊý¾Ý¿â£¬Ç°ÃæÒѾ¼òµ¥µÄ˵Ã÷¹ý£»
myisamchk ÓÃÀ´ÐÞ¸´.myiºó׺µÄÊý¾Ý¿âÎļþ£»
±ÈÈçÎÒÃÇÒª¼ì²éÃûΪlinuxµÄÊý¾Ý¿â.myiÊý¾Ý¿â±íÊÇ·ñ´æÔÚÎÊÌ⣬Ӧ¸ÃÓÃÏÂÃæµÄÃüÁ
Òª°Ñmysqld·þÎñÆ÷Í£ÏÂÀ´
[root@linuxsir01 root]# /opt/mysql/share/mysql.server stop
È»ºóÖ´ÐÐ
[root@linuxsir01 root]# /opt/mysql/bin/myisamchk /opt/mysql/var/linux/*.MYI
ÉÏÃæµÄÃüÁîµÄÒâ˼¾ÍÊǼì²éËùÓеÄ.myiÎļþ£¬Êý¾Ý¿âµÄĿ¼ÔÚ/opt/mysql/var/linux/Ŀ¼ÖÐ
Èç¹ûÓÐÎÊÌ⣬Ӧ¸ÃÓÃ-r²ÎÊýÀ´ÐÞ¸´
[root@linuxsir01 root]# /opt/mysql/bin/myisamchk -r /opt/mysql/var/linux/*.MYI
7]mysqlshow ÃüÁÏÔʾÓû§Ñ¡ÔñµÄÊý¾Ý¿âºÍ±í
[root@linuxsir01 root]# /opt/mysql/bin/mysqlshow -uroot -p [Êý¾Ý¿âÃû]
±ÈÈçÎÒÒª²é¿´ÃûΪlinuxµÄÊý¾Ý¿â£»Ó¦¸ÃÊÇ£º
[root@linuxsir01 root]# /opt/mysql/bin/mysqlshow -uroot -p linux
jianfei4 ÓÚ 2008-08-28 16:39:30·¢±í:
ÕâЩÃüÁîÓÐÓÃÂð