{"id":1076,"date":"2018-11-07T21:10:54","date_gmt":"2018-11-07T21:10:54","guid":{"rendered":"http:\/\/linuxmotto.ir\/blog\/?p=1076"},"modified":"2018-11-07T21:11:23","modified_gmt":"2018-11-07T21:11:23","slug":"%d8%aa%d8%ba%db%8c%db%8c%d8%b1-%d9%86%d8%a7%d9%85-database-%d8%a8%d8%b1-%d8%b1%d9%88%db%8c-mariadb","status":"publish","type":"post","link":"https:\/\/linuxmotto.io\/blog\/?p=1076","title":{"rendered":"\u062a\u063a\u06cc\u06cc\u0631 \u0646\u0627\u0645 database \u0628\u0631 \u0631\u0648\u06cc mariadb"},"content":{"rendered":"<p>\u0634\u0627\u06cc\u062f \u0628\u0631\u0627\u06cc \u0634\u0645\u0627 \u0647\u0645 \u067e\u06cc\u0634 \u0628\u06cc\u0627\u062f \u06a9\u0647 \u0628\u062e\u0648\u0627\u06cc\u0646 \u06a9\u0647 \u0646\u0627\u0645 \u062f\u06cc\u062a\u0627\u0628\u06cc\u0633 \u0631\u0627 \u062a\u063a\u06cc\u06cc\u0631 \u0628\u062f\u06cc\u062f. \u062e\u0648\u0628 \u0627\u06af\u0647 \u0627\u0632 phpmyadmin \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc\u200c\u06a9\u0646\u06cc\u062f \u06a9\u0647 \u0627\u0648\u0646 \u062e\u0648\u062f\u0634 \u0628\u0631\u0627\u062a\u0648\u0646 \u0627\u06cc\u0646 \u06a9\u0627\u0631 \u0631\u0627 \u0645\u06cc \u06a9\u0646\u0647. \u0648\u0644\u06cc \u0627\u06af\u0647 \u062e\u0648\u062f\u062a\u0648\u0646 \u0645\u06cc \u062e\u0648\u0627\u06cc\u062f \u0627\u0632 \u0637\u0631\u06cc\u0642 \u062e\u0637 \u0641\u0631\u0645\u0627\u0646 \u0627\u06cc\u0646 \u06a9\u0627\u0631 \u0631\u0627 \u0627\u0646\u062c\u0627\u0645 \u0628\u062f\u06cc\u062f\u060c \u0628\u0627\u06cc\u062f \u0628\u062f\u0648\u0646\u06cc\u062f \u06a9\u0647 \u062f\u0633\u062a\u0648\u0631\u06cc \u0628\u0631\u0627\u06cc \u0627\u06cc\u0646 \u06a9\u0627\u0631 \u0646\u062f\u0627\u0631\u06cc\u0645!<\/p>\n<p>\u067e\u0633 \u0628\u0631\u0627\u06cc \u0627\u0646\u062c\u0627\u0645 \u0627\u06cc\u0646 \u06a9\u0627\u0631 \u0628\u0627\u06cc\u062f \u0686\u06cc \u06a9\u0627\u0631 \u06a9\u0631\u062f. \u06cc\u06a9 \u0631\u0627\u0647 \u062d\u0644 \u0627\u0648\u0644\u06cc\u0647 \u0627\u06cc\u0646\u0647 \u06a9\u0647 \u06cc\u06a9 \u062f\u06cc\u062a\u0627\u0628\u06cc\u0633 \u062c\u062f\u06cc\u062f \u0628\u0627 \u0627\u0633\u0645 \u0645\u0648\u0631\u062f \u0646\u0638\u0631 \u0628\u0633\u0627\u0632\u06cc\u062f\u060c \u0627\u0632 \u062f\u06cc\u062a\u0627 \u0628\u06cc\u0633 \u0642\u0628\u0644\u06cc backup \u0628\u06af\u06cc\u0631\u06cc\u062f \u0648 \u0628\u0639\u062f \u062f\u0631 \u062f\u06cc\u062a\u0627\u0628\u06cc\u0633 \u062c\u062f\u06cc\u062f restore \u06a9\u0646\u06cc\u062f.<\/p>\n<pre class=\"lang:default decode:true \">mysqldump -u username -p -v olddatabase &gt; olddbdump.sql\r\nmysqladmin -u username -p create newdatabase\r\nmysql -u username -p newdatabase &lt; olddbdump.sql<\/pre>\n<p>&nbsp;<\/p>\n<p>\u0627\u06af\u0647 \u0628\u062e\u0648\u0627\u06cc\u0645 \u06cc\u0647 \u06a9\u0645 \u0628\u0627\u0631 I\/O \u0631\u0627 \u06a9\u0645 \u06a9\u0646\u06cc\u0645 \u0645\u06cc \u062a\u0648\u0646\u06cc\u0645 \u0627\u0632 \u062a\u0631\u0641\u0646\u062f \u0632\u06cc\u0631 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u0645 (\u0645\u0646 \u0627\u0632 stackoverflow \u067e\u06cc\u062f\u0627 \u06a9\u0631\u062f\u0645)<\/p>\n<pre class=\"lang:default decode:true \">mysqladmin -u username -p create newdatabase\r\nmysqldump -u username -v olddatabase -p | mysql -u username -p -D newdatabase<\/pre>\n<p>&nbsp;<\/p>\n<p>\u0627\u06af\u0647 \u0627\u0632 Innodb \u0628\u0631\u0627\u06cc \u062f\u06cc\u062a\u0627\u0628\u06cc\u0633 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc\u200c\u06a9\u0646\u06cc\u062f\u060c \u06cc\u0647 \u0631\u0648\u0634 \u06a9\u0645 \u0628\u0627\u0631 \u062a\u0631 \u0647\u0645 \u0645\u06cc \u062a\u0648\u0646\u06cc\u062f \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u062f. \u062f\u06cc\u062a\u0627\u0628\u06cc\u0633 \u062c\u062f\u06cc\u062f \u0628\u0627 \u0627\u0633\u0645 \u062c\u062f\u06cc\u062f \u0628\u0633\u0627\u0632\u06cc\u062f \u0648 \u0628\u0639\u062f table \u0647\u0627\u062a\u0648\u0646 \u0631\u0627 rename \u06a9\u0646\u06cc\u062f.<\/p>\n<pre class=\"lang:default decode:true \">RENAME TABLE old_db.table TO new_db.table;<\/pre>\n<p>&nbsp;<\/p>\n<p>\u0628\u0631\u0627\u06cc \u0627\u06cc\u0646\u06a9\u0647 \u0647\u0645\u0647 table \u0647\u0627 \u0631\u0627 \u06cc\u06a9\u062c\u0627 rename \u06a9\u0646\u06cc\u062f \u0627\u0632 \u062d\u0644\u0642\u0647 while \u06cc\u0627 for \u0645\u06cc \u062a\u0648\u0646\u06cc\u062f \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u062f<\/p>\n<pre class=\"lang:default decode:true \">mysql -u username -ppassword old_db -sNe \u2018show tables\u2019 | while read table; \\\r\ndo mysql -u username -ppassword -sNe \u201crename table old_db.$table to new_db.$table\u201d; done\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0634\u0627\u06cc\u062f \u0628\u0631\u0627\u06cc \u0634\u0645\u0627 \u0647\u0645 \u067e\u06cc\u0634 \u0628\u06cc\u0627\u062f \u06a9\u0647 \u0628\u062e\u0648\u0627\u06cc\u0646 \u06a9\u0647 \u0646\u0627\u0645 \u062f\u06cc\u062a\u0627\u0628\u06cc\u0633 \u0631\u0627 \u062a\u063a\u06cc\u06cc\u0631 \u0628\u062f\u06cc\u062f. \u062e\u0648\u0628 \u0627\u06af\u0647 \u0627\u0632 phpmyadmin \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0645\u06cc\u200c\u06a9\u0646\u06cc\u062f \u06a9\u0647 \u0627\u0648\u0646 \u062e\u0648\u062f\u0634 \u0628\u0631\u0627\u062a\u0648\u0646 \u0627\u06cc\u0646 \u06a9\u0627\u0631 \u0631\u0627 \u0645\u06cc \u06a9\u0646\u0647. \u0648\u0644\u06cc \u0627\u06af\u0647 \u062e\u0648\u062f\u062a\u0648\u0646 \u0645\u06cc \u062e\u0648\u0627\u06cc\u062f \u0627\u0632 \u0637\u0631\u06cc\u0642 \u062e\u0637 \u0641\u0631\u0645\u0627\u0646 \u0627\u06cc\u0646 \u06a9\u0627\u0631 \u0631\u0627 \u0627\u0646\u062c\u0627\u0645 \u0628\u062f\u06cc\u062f\u060c \u0628\u0627\u06cc\u062f \u0628\u062f\u0648\u0646\u06cc\u062f \u06a9\u0647 \u062f\u0633\u062a\u0648\u0631\u06cc \u0628\u0631\u0627\u06cc \u0627\u06cc\u0646 \u06a9\u0627\u0631 \u0646\u062f\u0627\u0631\u06cc\u0645! \u067e\u0633 \u0628\u0631\u0627\u06cc \u0627\u0646\u062c\u0627\u0645 \u0627\u06cc\u0646 \u06a9\u0627\u0631 \u0628\u0627\u06cc\u062f \u0686\u06cc \u06a9\u0627\u0631 \u06a9\u0631\u062f. \u06cc\u06a9 \u0631\u0627\u0647 \u062d\u0644 \u0627\u0648\u0644\u06cc\u0647 \u0627\u06cc\u0646\u0647 \u06a9\u0647 \u06cc\u06a9 \u062f\u06cc\u062a\u0627\u0628\u06cc\u0633 \u062c\u062f\u06cc\u062f \u0628\u0627 \u0627\u0633\u0645 \u0645\u0648\u0631\u062f \u0646\u0638\u0631 \u0628\u0633\u0627\u0632\u06cc\u062f\u060c \u0627\u0632 \u062f\u06cc\u062a\u0627 \u0628\u06cc\u0633 \u0642\u0628\u0644\u06cc backup \u0628\u06af\u06cc\u0631\u06cc\u062f \u0648 \u0628\u0639\u062f \u062f\u0631 \u062f\u06cc\u062a\u0627\u0628\u06cc\u0633 \u062c\u062f\u06cc\u062f restore \u06a9\u0646\u06cc\u062f. mysqldump -u username -p -v olddatabase &gt; olddbdump.sql mysqladmin -u username -p create newdatabase mysql -u username -p newdatabase &lt; olddbdump.sql &nbsp; \u0627\u06af\u0647 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[332,336,408,409,220],"class_list":["post-1076","post","type-post","status-publish","format-standard","hentry","category-administration","tag-mariadb","tag-mysql","tag-rename","tag-rename-database","tag-220"],"_links":{"self":[{"href":"https:\/\/linuxmotto.io\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1076","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxmotto.io\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxmotto.io\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxmotto.io\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxmotto.io\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1076"}],"version-history":[{"count":2,"href":"https:\/\/linuxmotto.io\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1076\/revisions"}],"predecessor-version":[{"id":1078,"href":"https:\/\/linuxmotto.io\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1076\/revisions\/1078"}],"wp:attachment":[{"href":"https:\/\/linuxmotto.io\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1076"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxmotto.io\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1076"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxmotto.io\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1076"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}