{"id":303,"date":"2026-04-07T10:57:24","date_gmt":"2026-04-07T01:57:24","guid":{"rendered":"https:\/\/falcon21.space\/kazuya\/work\/?page_id=303"},"modified":"2026-04-07T11:11:44","modified_gmt":"2026-04-07T02:11:44","slug":"mysql%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89","status":"publish","type":"page","link":"https:\/\/falcon21.space\/kazuya\/work\/?page_id=303","title":{"rendered":"mysql\u30b3\u30de\u30f3\u30c9"},"content":{"rendered":"\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>\u30ed\u30b0\u30a4\u30f3<\/strong># localhost\u306eMySQL\u30b5\u30fc\u30d0\u306b\u63a5\u7d9a\u3059\u308b\u5834\u5408<br>$<strong>&nbsp;mysql -u [\u30e6\u30fc\u30b6\u30fc\u540d] -p<\/strong><br><br># localhost\u306eMySQL\u30b5\u30fc\u30d0\u306b\u63a5\u7d9a\u3059\u308b\u5834\u5408\uff08\u30ef\u30f3\u30e9\u30a4\u30f3\u3067\u30d1\u30b9\u30ef\u30fc\u30c9\u307e\u3067\u6e21\u3059\uff09<br>$ mysql -u [\u30e6\u30fc\u30b6\u30fc\u540d] -p[\u30d1\u30b9\u30ef\u30fc\u30c9 \u203b \u5e73\u6587\u3067\u6e21\u3059\u3068\u30b3\u30de\u30f3\u30c9\u5c65\u6b74\u306b\u30d1\u30b9\u30ef\u30fc\u30c9\u304c\u8f09\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u907f\u3051\u307e\u3057\u3087\u3046]<br><br># \u5916\u90e8MySQL\u30b5\u30fc\u30d0\u306b\u63a5\u7d9a\u3059\u308b\u5834\u5408<br>$ mysql -u [\u30e6\u30fc\u30b6\u30fc\u540d] -p -h [host\u540d] -P [\u30dd\u30fc\u30c8\u756a\u53f7]<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><br><strong>\u30ed\u30b0\u30a2\u30a6\u30c8<\/strong><br>mysql &gt; \\q<br>mysql &gt; quit<br>mysql &gt;<strong>&nbsp;exit<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><br><strong>\u30d8\u30eb\u30d7<\/strong><br>mysql &gt; help<br>mysql &gt; \\h<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><br>\u30e6\u30fc\u30b6\u30fc\u60c5\u5831\u53d6\u5f97<br>mysql &gt;&nbsp;<strong>SELECT Host, User, Password FROM mysql.user;<\/strong><br><br><br><strong>\u30e6\u30fc\u30b6\u30fc\u306e\u8ffd\u52a0<\/strong><br>mysql &gt;&nbsp;<strong>create user `testuser`@`localhost` IDENTIFIED BY \u2018password\u2019;<\/strong><br><br><br><strong>\u30e6\u30fc\u30b6\u30fc\u306bDB\u64cd\u4f5c\u6a29\u9650\u3092\u4ed8\u4e0e<\/strong><br>mysql &gt;&nbsp;<strong>grant all privileges on test_db.* to testuser@localhost IDENTIFIED BY \u2018password\u2019;<\/strong><br><br><br><strong>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u4e00\u89a7\u306e\u8868\u793a<\/strong><br>mysql &gt;&nbsp;<strong>show databases;<\/strong><br><br><br><strong>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u4f5c\u6210\u8ffd\u52a0<\/strong><br>mysql &gt;<strong>&nbsp;create database test_db;<\/strong><br><br><br><strong>\u30c6\u30fc\u30d6\u30eb\u4e00\u89a7\u306e\u8868\u793a<\/strong><br>mysql &gt;<strong>&nbsp;show tables;<\/strong><br><br><br><strong>\u8a73\u7d30 \u8868\u793a<\/strong><br>mysql &gt;<strong>&nbsp;show table status;<\/strong><br><br><br><strong>\u5168\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u7279\u5b9a\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u691c\u7d22<\/strong><br>mysql &gt;&nbsp;<strong>SELECT table_name, column_name FROM information_schema.columns WHERE column_name = [\u691c\u7d22\u6761\u4ef6];<\/strong><br><br><br><strong>\u30c6\u30fc\u30d6\u30eb\u306e\u4f5c\u6210<\/strong><br>mysql &gt;&nbsp;<strong>CREATE TABLE [\u30c6\u30fc\u30d6\u30eb\u540d] (<br>[\u30d5\u30a3\u30fc\u30eb\u30c9\u540d] [\u30c7\u30fc\u30bf\u578b] [\u30aa\u30d7\u30b7\u30e7\u30f3]<br>) ENGINE=[InnoDB\/MyISAM] DEFAULT CHARSET=[\u6587\u5b57\u30b3\u30fc\u30c9];<\/strong><br><br><strong>\u30c6\u30fc\u30d6\u30eb\u306e\u524a\u9664<\/strong><br>mysql &gt;<strong>&nbsp;DROP TABLE [\u30c6\u30fc\u30d6\u30eb\u540d]<\/strong><br><br>\u3000\u2014\u2013\u3000<strong>IF EXISTS \u3092\u8ffd\u52a0<\/strong>\u3059\u308b\u3053\u3068\u3067TABLE\u304c\u5b58\u5728\u3059\u308b\u6642\u306e\u307f DROP TABLE \u6587\u3092\u5b9f\u884c\u3059\u308b<br>mysql &gt;<strong>&nbsp;DROP TABLE IF EXISTS [\u30c6\u30fc\u30d6\u30eb\u540d]<\/strong><br><br><br><strong>\u5168\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u30c0\u30f3\u30d7=\u30d0\u30c3\u30af\u30a2\u30c3\u30d7<\/strong><br>$&nbsp;<strong>mysqldump -u [\u30e6\u30fc\u30b6\u30fc\u540d] -p -x \u2013all-databases &gt; [\u51fa\u529b\u30d5\u30a1\u30a4\u30eb\u540d]<\/strong><br><br><br><strong>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u6307\u5b9a\u3057\u3066\u3001\u30c0\u30f3\u30d7<\/strong>\u3000<br>$&nbsp;<strong>mysqldump -u [\u30e6\u30fc\u30b6\u30fc\u540d] -p -x test_db &gt; [\u51fa\u529b\u30d5\u30a1\u30a4\u30eb\u540d]<\/strong><br>\u3000<br><br><strong>\u30c0\u30f3\u30d7\u30d5\u30a1\u30a4\u30eb\u306e\u30ea\u30b9\u30c8\u30a2<\/strong><br><strong>$ mysql -u[\u30e6\u30fc\u30b6\u30fc\u540d] -p new_db &lt; [\u30c0\u30f3\u30d7\u30d5\u30a1\u30a4\u30eb\u540d]<\/strong><\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u30ed\u30b0\u30a4\u30f3# localhost\u306eMySQL\u30b5\u30fc\u30d0\u306b\u63a5\u7d9a\u3059\u308b\u5834\u5408$&nbsp;mysql -u [\u30e6\u30fc\u30b6\u30fc\u540d] -p # localhost\u306eMySQL\u30b5\u30fc\u30d0\u306b\u63a5\u7d9a\u3059\u308b\u5834\u5408\uff08\u30ef\u30f3\u30e9\u30a4\u30f3\u3067\u30d1\u30b9\u30ef\u30fc\u30c9\u307e\u3067\u6e21\u3059\uff09$ mysql  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":289,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-303","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/falcon21.space\/kazuya\/work\/index.php?rest_route=\/wp\/v2\/pages\/303","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/falcon21.space\/kazuya\/work\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/falcon21.space\/kazuya\/work\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/falcon21.space\/kazuya\/work\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/falcon21.space\/kazuya\/work\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=303"}],"version-history":[{"count":1,"href":"https:\/\/falcon21.space\/kazuya\/work\/index.php?rest_route=\/wp\/v2\/pages\/303\/revisions"}],"predecessor-version":[{"id":305,"href":"https:\/\/falcon21.space\/kazuya\/work\/index.php?rest_route=\/wp\/v2\/pages\/303\/revisions\/305"}],"up":[{"embeddable":true,"href":"https:\/\/falcon21.space\/kazuya\/work\/index.php?rest_route=\/wp\/v2\/pages\/289"}],"wp:attachment":[{"href":"https:\/\/falcon21.space\/kazuya\/work\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}