{"id":38,"date":"2020-11-01T02:24:00","date_gmt":"2020-10-31T18:24:00","guid":{"rendered":"http:\/\/pro369.com\/linux\/?p=38"},"modified":"2020-11-01T02:24:00","modified_gmt":"2020-10-31T18:24:00","slug":"linux%e4%b8%bb%e6%a9%9f%e4%bc%ba%e6%9c%8d%e5%99%a8%e6%9e%b6%e8%a8%ad%e6%8a%80%e8%a1%93%ef%bc%88%e4%b8%bb%e6%a9%9f%e8%b3%87%e6%96%99%e7%a7%bb%e8%bd%89%ef%bc%89","status":"publish","type":"post","link":"https:\/\/por.tw\/linux\/linux%e4%b8%bb%e6%a9%9f%e4%bc%ba%e6%9c%8d%e5%99%a8%e6%9e%b6%e8%a8%ad%e6%8a%80%e8%a1%93%ef%bc%88%e4%b8%bb%e6%a9%9f%e8%b3%87%e6%96%99%e7%a7%bb%e8%bd%89%ef%bc%89\/","title":{"rendered":"Linux\u4e3b\u6a5f\u4f3a\u670d\u5668\u67b6\u8a2d\u6280\u8853\uff08\u4e3b\u6a5f\u8cc7\u6599\u79fb\u8f49\uff09"},"content":{"rendered":"<p><span style=\"background-color: #ffff00; font-size: medium;\"><strong>Linux\u4e3b\u6a5f\u4f3a\u670d\u5668\u67b6\u8a2d\u6280\u8853\uff08\u4e3b\u6a5f\u8cc7\u6599\u79fb\u8f49\uff09<\/strong><\/span><\/p>\n<p><strong><span style=\"color: #800000;\">\u00a0\u4e3b\u6a5f\u7684\u79fb\u8f49\u8981\u638c\u63e1\u4ee5\u4e0b\u5e7e\u9ede\u539f\u5247\uff1a<\/span><\/strong><\/p>\n<p><strong><span style=\"color: #008000;\">\u00a0\u00a0 1. \u8981\u6ce8\u610f\u539f\u7db2\u9801\u61c9\u7528\u8edf\u9ad4\u4e4b\u5b89\u5168\u6027<br \/>\n\u6709\u4e9b\u820a\u7684\u8edf\u9ad4\uff0c\u53ef\u80fd\u5df2\u6709\u6f0f\u6d1e\uff0c\u4e0d\u8981\u518d\u628a\u820a\u7684\u7248\u672c\u8f49\u79fb\u904e\u4f86\u3002<br \/>\n2. \u5728\u79fb\u8f49\u8cc7\u6599\u7684\u540c\u6642\uff0c\u5fc5\u9808\u8981\u6ce8\u610f\uff0c\u8a72\u8cc7\u6599\u7684\u6a94\u6848\u6b0a\u9650\u3002\u4e0d\u8981\u5728\u5b8c\u6210\u8cc7\u6599\u79fb\u8f49\u4e4b\u5f8c\uff0c\u4e00\u822c user \u90fd\u300c\u770b\u300d\u4e0d\u5230\uff0c\u53ea\u5269 root \u4e00\u500b\u624d\u770b\u5f97\u5230\u3002<\/span><\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/visdacom.com\/linux\/wp-content\/uploads\/2019\/08\/Linux-Server-Project-4-650x433.jpg\" alt=\"\" class=\"alignnone size-medium wp-image-489\" width=\"650\" height=\"433\" \/><\/p>\n<p>3. \u53ef\u5728\u5169\u53f0 Linux \u4e4b\u9593\u76f4\u63a5\u4f7f\u7528 gFtp \u8edf\u9ad4\uff0c\u4ee5 SFTP2 (SSH2) \u5354\u5b9a\u3001 Root \u8eab\u4efd\uff0c\u76f4\u63a5\u628a\u5404\u7a2e\u8cc7\u6599\u5f9e\u820a\u6a5f\u5668\u50b3\u9001\u5230\u65b0\u6a5f\u5668\u4e0a\u3002<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/visdacom.com\/linux\/wp-content\/uploads\/2013\/04\/9435209677.jpg\" width=\"285\" height=\"177\" \/><\/p>\n<p><span style=\"color: #ff0000;\"><strong>\u8cc7\u6599\u5eab\u79fb\u8f49<\/strong><\/span><\/p>\n<p>* \u8cc7\u6599\u5eab\u4f4d\u7f6e\uff1a\/var\/lib\/mysql<br \/>\n* \/var\/lib\/mysql\/mysql \u53ca \/var\/lib\/mysql\/test \u4e0d\u53ef\u642c\u52d5<br \/>\n\u9664\u4e86\u4e0a\u8ff0\u9019\u5169\u500b\u8cc7\u6599\u593e\u4e0d\u53ef\u642c\u52d5\u5916\uff0c\u5176\u9918\u5728 \/var\/lib\/mysql\/ \u5e95\u4e0b\u7684\u8cc7\u6599\u593e\uff08\u8cc7\u6599\u5eab\uff09\uff0c\u7686\u53ef\u4ee5\u642c\u5230\u65b0 Linux Server\u4e3b\u6a5f\u7684 \/var\/lib\/mysql \u5e95\u4e0b\u3002<br \/>\n\u56e0\u70ba \/var\/lib\/mysql\/mysql \u662f MySQL \u7684\u7cfb\u7d71\u8cc7\u6599\u5eab\uff0c\u5b83\u8a18\u9304\u4e86\u8a31\u8a31\u591a\u591a MySQL Server \u7684\u8a2d\u5b9a\u53c3\u6578\u3002\u800c\u4e14\uff0c\u820a\u7248\u7684 MySQL \u8207\u65b0\u7248\u7684 MySQL \uff0c\u7cfb\u7d71\u8cc7\u6599\u5eab\u6703\u6709\u6b04\u4f4d\u5b9a\u7fa9\u4e0a\u7684\u4e0d\u540c\uff0c\u82e5\u60a8\u628a\u820a\u7248\u7cfb\u7d71\u8cc7\u6599\u5eab\uff0c\u76f4\u63a5\u8986\u84cb\u5230\u65b0\u7248\u4e4b\u4e0a\uff0c\u53ef\u80fd\u6703\u9020\u6210 MySQL \u555f\u52d5\u5931\u6557\u3002<br \/>\n\u4f8b\u5916\uff1a\u82e5\u662f\u65b0\u820a\u4e3b\u6a5f\u7684 Linux\/Linux Server \u7248\u672c\u4e00\u81f4\uff0c\u7406\u8ad6\u4e0a\u5176 MySQL \u7248\u672c\u61c9\u8a72\u4e5f\u4e00\u81f4\uff0c\u5c31\u53ef\u4ee5\u57f7\u884c\u4ee5\u4e0b\u52d5\u4f5c\u5373\u53ef<br \/>\n1. \u76f4\u63a5\u628a \/var\/lib\/mysql\/ \u5e95\u4e0b\u6240\u6709\u8cc7\u6599\u593e\u8907\u88fd\u5230\u65b0\u4e3b\u6a5f\u4e0a\u76f8\u540c\u7684\u4f4d\u7f6e\u4e0a<br \/>\n2. \u4e0d\u5fc5\u518d\u52d5 MySQL \u4f7f\u7528\u8005\u6b0a\u9650\u7684\u90e8\u4efd<br \/>\n* \u8907\u88fd\u5230\u65b0\u4e3b\u6a5f\u6642\uff0c\u8981\u8a18\u5f97\u628a \/var\/lib\/mysql \u5e95\u4e0b\u6240\u6709\u7684\u8cc7\u6599\u593e(\u8cc7\u6599\u5eab\uff09\u6b0a\u9650\uff0c\u6539\u70ba mysql.mysql<br \/>\nroot@dns:~# chown -R mysql.mysql \/var\/lib\/mysql\/*<br \/>\n* \u5728 Linux \u5e95\u4e0b\u53ef\u4ee5\u4f7f\u7528 filezilla \u4ee5 SFTP \u7684\u5354\u5b9a\uff0c\u76f4\u63a5\u7528 Root \u8eab\u4efd\u9032\u884c\u642c\u52d5<br \/>\nroot@dns:~# apt-get install filezilla<br \/>\n* \u6aa2\u67e5\u6240\u6709 PHP+MySQL\u7a0b\u5f0f\u78bc(\u5982 ANN \u516c\u544a\u6b04&#8230;etc)\uff0c\u628a\u6240\u4f7f\u7528\u5230\u7684 MySQL \u4f7f\u7528\u8005\u5e33\u865f\u5bc6\u78bc\uff0c\u65b0\u589e\u81f3\u65b0\u4e3b\u6a5f\u7684 MySQL \u5167<br \/>\n\u4f7f\u7528 phpmyadmin\uff0c\u4f8b\uff1a http:\/\/Your.ServerName\/phpmyadmin<br \/>\n\u5728\u9996\u9801\u4e0a\u9ede\uff1a\u300c\u6b0a\u9650\u300d \u2192 \u300c\u65b0\u589e\u4f7f\u7528\u8005\u300d (\u65b0\u589e MySQL \u7684\u4f7f\u7528\u8005)<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\n<span style=\"color: #800000; font-size: medium;\"><strong>\u7db2\u9801\u642c\u5bb6<\/strong><\/span><\/p>\n<p>* \u7db2\u9801\u4f4d\u7f6e<br \/>\nRed Hat \u7cfb\u5217\uff1a \/var\/www\/html<br \/>\nLinux\/Linux \u7cfb\u5217\uff1a \/var\/www<br \/>\n\u2606.\u81ea\u884c\u7de8\u8b6f\u5b89\u88dd\uff1a \/usr\/local\/apache2\/htdocs<br \/>\n* \u53ef\u4ee5\u4f7f\u7528\u5716\u5f62\u5316\u5de5\u5177 gFtp \u4ee5 SFTP \u7684\u5354\u5b9a\uff0c\u76f4\u63a5\u7528 Root \u8eab\u4efd\u9032\u884c\u642c\u52d5<br \/>\n\u2606.\u4f8b1\uff1a\u5f9e\u820a Red Hat(\u542b Fedora) \u4e4b\/var\/www\/html \u2192 Linux Server \u4e4b \/var\/www<br \/>\n* \u4e5f\u53ef\u7528\u6307\u4ee4 scp<br \/>\n\u4f8b\uff1a\u4ee5 root \u8eab\u4efd\u628a\u9060\u7aef\u7684 \/var\/www\/sfs3 \u8907\u88fd\u56de\u672c\u6a5f\u4e4b \/var\/www\/sfs3 \u5e95\u4e0b<br \/>\nroot@dns:~# scp root@your.old.host:\/var\/www\/sfs3 \/var\/www<br \/>\n* \u6ce8\u610f\uff1aLinux \u7684 Apache2 Server \u5728\u9001\u51fa\u7db2\u9801\u6642\uff0c\u9810\u8a2d\u6703\u63a1\u7528 utf8 \u7de8\u78bc\uff0c\u53ef\u662f\u539f\u4e3b\u6a5f\u4e0a\u7684\u7db2\u9801\u537b\u53ef\u80fd\u662f Big5 \uff0c\u6b64\u6642\uff0c\u6211\u5011\u5fc5\u9808\u628a\u9810\u8a2d\u7de8\u78bc\u89e3\u9664\uff0c\u4e26\u52a0\u5f37\u5176\u591a\u570b\u8a9e\u8a00\u7de8\u78bc\u4e4b\u8655\u7406\u80fd\u529b\u3002<br \/>\n\u2606.\u89e3\u9664\u9001\u51fa\u7db2\u9801\u6642\u7684\u9810\u8a2d\u7de8\u78bc<br \/>\n\u7de8\u8f2f \/etc\/apache2\/conf.d\/charset \uff0c\u628a AddDefaultCharset UTF-8 \u8b8a\u6210\u8a3b\u89e3<\/p>\n<p># AddDefaultCharset UTF-8<br \/>\n\u2606.\u52a0\u5f37\u591a\u570b\u8a9e\u8a00\u7de8\u78bc\u8655\u7406\u80fd\u529b\uff0c\u7de8\u8f2f \/etc\/apache2\/sites-available\/default \uff0c\u65b0\u589e\u7d05\u5b57\u90e8\u5206\u3002<\/p>\n<p>&lt;VirtualHost *:80&gt;<br \/>\nServerAdmin webmaster@n10.domo.tnc.edu.tw<br \/>\nServerName n10.domo.tnc.edu.tw<\/p>\n<p>DocumentRoot \/var\/www\/<br \/>\n&lt;Directory \/&gt;<br \/>\nOptions FollowSymLinks MultiViews<br \/>\nAllowOverride None<br \/>\n&lt;\/Directory&gt;<br \/>\n&#8230;<\/p>\n<p><span style=\"color: #800080; font-size: medium;\"><strong>\u4f7f\u7528\u8005\u642c\u5bb6\uff08\u5bb6\u76ee\u9304\u79fb\u8f49\uff09<\/strong><\/span><\/p>\n<p>* \u5404\u4f7f\u7528\u8005\u7684\u5bb6\u76ee\u9304\uff0c\u96c6\u4e2d\u5728 \/home\/ \u5e95\u4e0b<br \/>\n* \u7528 gFtp \u4ee5 SFTP \u7684\u5354\u5b9a\uff0c\u76f4\u63a5\u7528 Root \u8eab\u4efd\u9032\u884c\u642c\u52d5(\u6a94\u6848\u6b0a\u9650\uff0c\u6703\u88ab\u6539\u70ba root.root)<\/p>\n<p>User \u79fb\u8f49<\/p>\n<p>Linux \u7684 User \u76f8\u95dc\u8cc7\u6599\u5982\u4e0b\uff1a<\/p>\n<p>* \u5404\u4f7f\u7528\u8005\u8cc7\u6599\u593e \/home\/*<br \/>\n* \u8a2d\u5b9a\u6a94 \/etc\/passwd<br \/>\n* \u5bc6\u78bc\u6a94 \/etc\/shadow<br \/>\n* \u7fa4\u7d44\u6a94 \/etc\/group<br \/>\n* \u7fa4\u7d44\u5bc6\u78bc\u6a94 \/etc\/gshadow<\/p>\n<p>\u82e5\u662f Linux Server \u6216 Linux pureXXX \u7684\u820a\u4e3b\u6a5f\uff0c\u79fb\u8f49\u81f3 Linux Server\u3002\u628a\u4e0a\u5217\u5404\u6a94\uff0c\u6709\u95dc\u4f7f\u7528\u8005\u7684\u90e8\u4efd\uff0c\u300c\u8907\u88fd\u300d\uff0f\u300c\u8cbc\u4e0a\u300d\u81f3\u65b0\u4e3b\u6a5f\u540c\u540d\u6a94\u6848\u7684\u6a94\u5c3e\u90e8\u4efd\u3002\u4ee5 \/etc\/passwd \u8209\u4f8b\u5982\u4e0b\uff1a<\/p>\n<p>1. \u628a\u820a\u4e3b\u6a5f passwd, shadow, group, gshadow \u50b3\u8f38\u81f3\u65b0\u4e3b\u6a5f \/root \u5e95\u4e0b<br \/>\n2. \u4f7f\u7528\u6587\u5b57\u7de8\u8f2f\u5668\uff0c\u5982 gedit \u6253\u958b \/root\/passwd \uff0c\u8907\u88fd\u820a\u4e3b\u6a5f\u4e0a\u7684\u4f7f\u7528\u8005\u8cc7\u6599\uff0c\u8cbc\u81f3\u65b0\u4e3b\u6a5f\u7684 \/etc\/passwd \u7684\u6a94\u5c3e\u8655\uff08\u4e0d\u8981\u52d5\u5230\u539f\u672c\u7684\u8cc7\u6599\uff09\u3002<\/p>\n<p><span style=\"color: #800000;\"><strong>\u6b78\u9084\u5176\u539f\u6709\u6b0a\u9650<\/strong><\/span><\/p>\n<p>* \u6700\u5f8c\uff0c\u8981\u628a\u6b0a\u9650\u9084\u7d66\u8a72\u4f7f\u7528\u8005<br \/>\nroot@dns:~# chown -R user.user \/home\/user<br \/>\n\u2606.\u8a3b\uff1a\u4ee5\u4e0a chown \u8981\u5728\u4e0b\u9762 User \u79fb\u8f49\u5b8c\u7562\uff0c\u624d\u53ef\u4ee5\u8655\u7406<br \/>\n* \u82e5\u4eba\u6578\u904e\u591a\uff0c\u9019\u88e1\u6709\u5feb\u901f\u505a\u6cd5<br \/>\nhttp:\/\/myip.tw\/itsmw\/index.php\/Home_chowner<\/p>\n<p>\u7db2\u9801\u8cc7\u6599\u5eab\u7de8\u78bc\u8f49\u63db<\/p>\n<p>\u672c\u6587\u4ecb\u7d39\u5982\u4f55\u5728 Linux Server \u4e0b\u628a Big5 \u78bc\u7684\u7db2\u9801\u66a8\u5176\u8cc7\u6599\u5eab\u8f49\u6210 UTF8 \u78bc\uff0c\u4e26\u8f49\u81f3 Linux \u4e0a\u7684\u8cc7\u6599\u5eab\u3002\u7576\u7136\uff0c\u9019\u4e26\u4e0d\u662f\u5fc5\u8981\u6027\u52d5\u4f5c\uff0c\u672c\u6587\u5728\u6b64\u53ea\u662f\u63d0\u4f9b\u4e00\u500b\u4f5c\u6cd5\u7d66\u5927\u5bb6\u53c3\u8003\u800c\u5df2\uff0c\u4e26\u4e0d\u9f13\u52f5\u5927\u5bb6\u628a\u6240\u6709\u7db2\u9801\u66a8\u5176\u8cc7\u6599\u5eab\u8f49\u78bc\u3002<\/p>\n<p>\u8cc7\u6599\u5eab\u8f49\u78bc<\/p>\n<p>\u5728\u6b64\uff0c\u7b46\u8005\u4ee5\u81ea\u5df1\u6240\u5beb\u7684\u4e00\u652f Big5 \u5c0f\u7a0b\u5f0f\u300c\u5b78\u751f\u8cc7\u8a0a\u6aa2\u6e2c\u7df4\u7fd2\u5340\u300d\u4f86\u64d4\u4efb\u672c\u6b21\u7684\u7bc4\u4f8b\uff0c\u5b83\u5167\u542b\u4e09\u652f php \u7a0b\u5f0f\u78bc\u4ee5\u53ca\u4e00\u500b\u8cc7\u6599\u5eab\uff08\u5169\u5f35\u8868\uff09\u3002<\/p>\n<p><span style=\"color: #008000;\"><strong>Linux Server \u4e0a\u628a\u8cc7\u6599\u5eab\u8f49\u51fa<\/strong><\/span><\/p>\n<p>* \u628a\u6574\u500b Big5 \u78bc\u8cc7\u6599\u5eab\uff0c\u5728 Linux Server \u4e0a\u7528 phpmyadmin \u8f49\u51fa\u6210 SQL \u6a94<br \/>\n\u2606.Step1 \u5728 phpmyadmin \u9996\u9801\u4e0a\u9ede\u9078\u300c\u8f38\u51fa\u300d<\/p>\n<p>\u2606.Step2 \u9078\u59a5\u6240\u8981\u4e0b\u8f09\u7684\u8cc7\u6599\u5eab &#8211;&gt; \u8f49\u6210 sql \u6a94<\/p>\n<p>* \u9810\u8a2d\u6703\u5b58\u6210 localhost.sql , \u6211\u5011\u628a\u5b83\u6539\u6210 compuexam.sql\uff0c\u4e26\u653e\u5230 \/root \u5e95\u4e0b<br \/>\nroot@dns:~# mv localhost.sql compuexam.sql<br \/>\n* \u9810\u8655\u7406 compuexam.sql \u628a\u6587\u5b57\u6a94\u5167\u53ef\u80fd\u6703\u51fa\u73fe\u932f\u8aa4\uff0c\u5982\u300c&#8217;\u6210\u529f&#8217;\u300d\u8b8a\u6210\u300c&#8217;\u6210\u529f&#8217;\u300d<br \/>\nroot@dns:~# vi compuexam.sql<br \/>\n\u5728 vim \u5167\u4e0b\u53d6\u4ee3\u547d\u4ee4\uff1a\u300c:%s\/&#8217;\/&#8217;\/g\u300d\u5f8c\u5b58\u6a94<\/p>\n<p>* \u4e0b\u8f09 ols3 \u63d0\u4f9b\u7684\u8f49\u78bc\u5de5\u5177<br \/>\nroot@dns:~# wget http:\/\/myip.tw\/itsmw\/images\/f\/fe\/B2U.zip<\/p>\n<p>* \u57f7\u884c\u8f49\u78bc\u4f5c\u696d<\/p>\n<p>1. \u628a B2U.zip \u89e3\u58d3<br \/>\nroot@dns:~# unzip B2U.zip &#8211;&gt; \u6703\u89e3\u51fa\u57f7\u884c\u6a94 bg5-db2-utf8<br \/>\n2. \u8f49\u78bc\u81f3\u65b0\u8cc7\u6599\u5eab new_ce<br \/>\nroot@dns:~# .\/bg5-db2-utf8 compuexam.sql new_ce mysql_passwd<br \/>\n\u8a3b\uff1a\u4f7f\u7528\u6cd5\u70ba\u300c.\/bg5-db2-utf8 \u5df2\u532f\u51fa\u7684sql\u6a94\u8def\u5f91\u6a94\u540d \u65b0\u7684\u8cc7\u6599\u5eab\u540d\u7a31 MySQL\u7ba1\u7406\u5bc6\u78bc\u300d<\/p>\n<p>\u8f49\u5165 Linux Server \u4e0a\u7684 MySQL \u8cc7\u6599\u5eab<\/p>\n<p>* \u7531\u4e0a\u8ff0\u65b9\u5f0f\u88fd\u4f5c\u51fa\u7684\u8cc7\u6599\u5eab\uff0c\u5176\u5be6\u662f\u9810\u8a2d\u63a1\u7528 latin1 \u5b57\u96c6\u5b9a\u7fa9\uff0c\u4f46\u9aa8\u5b50\u88e1\u653e\u7684\u662f utf8 \u78bc\u7684\u8cc7\u6599\u5eab\uff0c\u4f7f\u7528\u5b98\u65b9\u7248\u7684 phpmyadmin \u6703\u7121\u6cd5\u6b63\u78ba\u986f\u793a\u5176\u6587\u5b57\uff0c\u4e0d\u904e\u53ef\u4ee5\u6539\u7528\u7b46\u8005\u4fee\u6539\u7684 phpMyAdmin\u89e3\u6c7a\u6b64\u4e00\u554f\u984c\u3002<br \/>\n\u2606.\u4e0b\u8f09\u4e26\u653e\u81f3 \/var\/www<br \/>\nroot@dns:~# cd \/var\/www<br \/>\nroot@dns:\/var\/www# wget http:\/\/myip.tw\/itsmw\/images\/f\/fb\/PhpMyA.zip<br \/>\nroot@dns:\/var\/www# unzip PhpMyA.zip<br \/>\n\u2606.\u700f\u89bd\u65b9\u5f0f\u00a0\u00a0 http:\/\/your.Linux.server\/phpMyA<br \/>\n\u2606.\u9032\u5165\u9996\u9801\u5f8c\uff0c\u5148\u9078\u59a5\u53f3\u5074\u8a9e\u8a00\u70ba\uff1a Language: \u4e2d\u6587utf8 &#8212; Chinese traditional(utf8)<br \/>\n* \u518d\u4f86\uff0c\u53ea\u8981\u628a Linux server \u4e0a \/var\/lib\/mysql\/new_ce \u6574\u500b\u8cc7\u6599\u593e\u642c\u81f3 Linux \u4e0a\u7684 \/var\/lib\/mysql \u5e95\u4e0b\uff0c\u4e26 chown \u70ba mysql.mysql \u4fbf\u5b8c\u6210 utf8 \u8cc7\u6599\u5eab\u7684\u88fd\u4f5c<\/p>\n<p><span style=\"color: #0000ff;\"><strong>\u9032\u4e00\u6b65\u8f49\u6210\u7b26\u5408 MySQL 5.x UTF8 \u7de8\u78bc\u6821\u5c0d\u4e4b\u8cc7\u6599\u5eab<\/strong><\/span><\/p>\n<p>\u63a5\u8457\uff0c\u6211\u5011\u53ef\u4ee5\u518d\u5229\u7528\u7b46\u8005\u7684 phpMyA \u8f38\u51fa new_ce \u8cc7\u6599\u5eab\uff0c\u6539\u5beb\u90e8\u5206\u5167\u5bb9\uff0c\u518d\u7528\u5b98\u65b9 phpmyadmin \u532f\u5165\u6210\u6a19\u6e96 MySQL 5.x \u7248\u63a5\u53d7\u7684 UTF8 \u7de8\u78bc\u8cc7\u6599\u5eab\u3002\u4ee5\u4e0b\u64cd\u4f5c\u662f\u5728 Linux Server \u4e0a\uff0c\u4f5c\u6cd5\u5982\u4e0b\uff1a<\/p>\n<p>* new_ce \u8cc7\u6599\u5eab\u524d\u7f6e\u8655\u7406<\/p>\n<p>1. \u7528 phpMyA \u628a new_ce \u8cc7\u6599\u5eab\u8f38\u51fa\u6210 localhost.sql<br \/>\n2. \u6539\u5beb localhost.sql \uff0c\u628a\u4ee5\u4e0b\u9019\u5169\u884c\u522a\u9664<\/p>\n<p>CREATE DATABASE `new_ce`;<br \/>\nUSE new_ce;<br \/>\n3. \u628a\u6240\u6709\u5efa\u7acb\u8cc7\u6599\u8868\u6700\u5f8c\u4e00\u884c DEFAULT CHARSET=latin1 \u6539\u6210 DEFAULT CHARSET=utf8<\/p>\n<p>CREATE TABLE IF NOT EXISTS `table name` (<br \/>\n&#8230;<br \/>\n&#8230;<br \/>\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 &#8230;;<\/p>\n<p>* \u4f7f\u7528\u5b98\u65b9 phpmyadmin \u5efa\u7acb newutf8 \u8cc7\u6599\u5eab\uff0c\u793a\u4f8b\u5982\u4e0b<\/p>\n<p>* \u518d\u9ede\u9078 newutf8 \u8cc7\u6599\u5eab &#8211;&gt; \u3010\u8f09\u5165\u3011 &#8211;&gt; \u9078 localhost.sql &#8211;&gt; MySQL\u76f8\u5bb9\u6a21\u5f0f\u8981\u9078\u7528 MYSQL40 &#8211;&gt; \u3010\u57f7\u884c\u3011<\/p>\n<p>* \u9019\u6a23\u5c31\u53ef\u4ee5\u4f7f\u7528\u5b98\u65b9 phpmyadmin \u4f86\u6aa2\u8996\u8a72\u8cc7\u6599\u5eab\uff0c\u4e0d\u904e\u672c\u52d5\u4f5c\u53ef\u80fd\u6703\u5c0e\u81f4\u60a8\u820a PHP \u7a0b\u5f0f\u78bc\uff08SQL \u8a9e\u6cd5\u592a\u820a\uff0c\u6c92\u52a0\u5165\u8a9e\u7cfb\u6821\u5c0d\uff09\u7121\u6cd5\u8b80\u53d6\u8a72\u8cc7\u6599\u5eab\uff0c\u6240\u4ee5\u8acb\u614e\u601d\u662f\u5426\u8981\u9019\u9ebc\u505a!<\/p>\n<p><span style=\"color: #ff00ff; font-size: large;\"><strong>\u7db2\u9801\u8f49\u78bc<\/strong><\/span><span style=\"color: #ff00ff;\"><strong>\uff1a<\/strong><\/span><\/p>\n<p>\u4f9d\u672c\u4f8b\uff0c\u4e0d\u6b62\u8981\u642c\u52d5 compuexam \u70ba new_ce \u8cc7\u6599\u5eab\uff0c\u9084\u8981\u628a\u5176\u61c9\u7528\u7a0b\u5f0f\uff1a\/var\/www\/compuexam\/ \u5e95\u4e0b\u6240\u6709\u7684 PHP \u7a0b\u5f0f\u8f49\u78bc\u70ba utf8 \u624d\u7b97\u5b8c\u6210\u3002<\/p>\n<p>* \u5148\u5f9e Linux Server \u628a \/var\/www\/compuexem \u8907\u88fd\u81f3 Linux Server \u7684 \/var\/www\/compuexam<br \/>\n* \u5728 Linux Server \u7684 \/var\/www\/compuexam \u4e0b\u5efa\u7acb\u4ee5\u4e0b\u4e4b shell \u6a94<br \/>\nroot@dns:~# vi \/var\/www\/compuexam\/b2utf8.sh<\/p>\n<p>#! \/bin\/sh<br \/>\nfor i in *.php; d\u2606.<br \/>\nech\u2606.&#8221;$(iconv -f big5 -t utf8 $i)&#8221; &gt; $i<br \/>\ndone<\/p>\n<p>* \u5728 \/var\/www\/compuexam \u57f7\u884c\u8a72 shell<br \/>\nroot@dns:~# cd \/var\/www\/compuexam<br \/>\nroot@dns:\/var\/www\/compuexam# chmod +x b2utf8.sh<br \/>\nroot@dns:\/var\/www\/compuexam# .\/b2utf8.sh<\/p>\n<p>* \u4fee\u6539\u6240\u6709\u7684 PHP \u7a0b\u5f0f\u78bc\uff0c\u628a\u8a9e\u8a00\u5ba3\u544a\u6539\u6210 UTF-8\uff0c\u5982\u4e0b\u6240\u793a<\/p>\n<p>&lt;meta http-equiv=&#8221;content-type&#8221; content=&#8221;text\/html; charset=UTF-8&#8243; \/&gt;<\/p>\n<p><span style=\"color: #ff0000;\"><strong>\u6ce8\u610f\u8cc7\u6599\u5eab\u5bc6\u78bc<\/strong><strong>\uff1a<\/strong><\/span><\/p>\n<p><span style=\"color: #800080;\"><strong>\u00a0\u00a0\u00a0 * \u6bcf\u652f PHP+MySQL \u7684 PHP \u7a0b\u5f0f\u78bc\uff0c\u5fc5\u5b9a\u6703\u6709\u8a2d\u5b9a\u8cc7\u6599\u5eab\u5bc6\u78bc\u7684\u7a0b\u5f0f\u78bc\uff0c\u56e0\u6b64\uff0c\u5f9e Linux Server \u8f49\u81f3 Linux \u5f8c\uff0c\u8981\u6253\u958b\u8a72\u7a0b\u5f0f\u6aa2\u8996 MySQL \u7684\u5bc6\u78bc\u662f\u5426\u6b63\u78ba<\/strong><\/span><\/p>\n<p>* \u53e6\u5916\uff0c PHP \u7a0b\u5f0f\u78bc\u4e4b\u8cc7\u6599\u5eab\u540d\u7a31\u8a2d\u5b9a\u4e5f\u8981\u8a18\u5f97\u4fee\u6539<\/p>\n<p>* \u82e5\u4e00\u5207\u5c31\u7dd2\uff0c\u5c31\u53ef\u4ee5\u6e2c\u8a66\u700f\u89bd<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux\u4e3b\u6a5f\u4f3a\u670d\u5668\u67b6\u8a2d\u6280\u8853\uff08\u4e3b\u6a5f\u8cc7\u6599\u79fb\u8f49\uff09 \u00a0\u4e3b\u6a5f\u7684\u79fb\u8f49\u8981\u638c\u63e1\u4ee5\u4e0b\u5e7e\u9ede\u539f\u5247\uff1a \u00a0\u00a0 1. \u8981\u6ce8\u610f\u539f\u7db2\u9801\u61c9\u7528\u8edf [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":489,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[21],"class_list":["post-38","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-linux"],"_links":{"self":[{"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/posts\/38"}],"collection":[{"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/comments?post=38"}],"version-history":[{"count":0,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/posts\/38\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/media\/489"}],"wp:attachment":[{"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/media?parent=38"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/categories?post=38"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/tags?post=38"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}