{"id":576,"date":"2012-10-29T01:57:59","date_gmt":"2012-10-29T01:57:59","guid":{"rendered":"http:\/\/apollo89.com\/wordpress\/?p=576"},"modified":"2013-02-21T12:12:18","modified_gmt":"2013-02-21T03:12:18","slug":"python-mysql-%ec%97%b0%eb%8f%99-2","status":"publish","type":"post","link":"https:\/\/apollo89.com\/wordpress\/?p=576","title":{"rendered":"python mysql \uc5f0\ub3d9"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>\uc124\uce58 \ud558\uae30 \uc804\uc5d0 python \ubc84\uc804\uc744 \ud655\uc778.<\/p>\n<pre class=\"lang:default decode:true\">[root@test install]# python -V\r\nPython 2.4.3\r\n<\/pre>\n<p>MySQL-python \uc744 \uc0ac\uc6a9\ud558\ub824\uace0 \ud558\ub294\ub370, MySQL-python \uc740  2.4-2.7\ubc84\uc804\uc744 \uc9c0\uc6d0.<br \/>\nhttp:\/\/sourceforge.net\/projects\/mysql-python\/ \uc758 \uc544\ub798\ubd80\ubd84 \ucc38\uace0.<br \/>\n* Python versions 2.4-2.7; Python 3 support coming soon.<\/p>\n<p>\ud544\uc694\ud55c \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \uc124\uce58.<\/p>\n<pre class=\"lang:default decode:true\">[root@test install]# yum install gcc mysql-devel python-devel<\/pre>\n<p>SetupTools \uc124\uce58.<br \/>\nSetupTools\ub294 Python\uc73c\ub85c \ub9cc\ub4e0 \ud504\ub85c\uadf8\ub7a8\uc744 \uc790\ub3d9\uc73c\ub85c \ub2e4\uc6b4\ub85c\ub4dc\ud558\uace0 \uc124\uce58\ud558\ub294 \uac83\uc744 \uc9c0\uc6d0\ud558\ub294 python distutils \uc758 \ud655\uc7a5 \uc720\ud2f8\ub9ac\ud2f0 \uc774\ub2e4.<\/p>\n<pre class=\"lang:default decode:true\">[root@test install]# wget http:\/\/pypi.python.org\/packages\/source\/s\/setuptools\/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e\r\n[root@test install]# tar xzvf setuptools-0.6c11.tar.gz\r\n[root@test install]# cd setuptools-0.6c11\r\n[root@test install]# python setup.py install\r\n<\/pre>\n<p>\u00a0<br \/>\nMySQL-python \uc124\uce58<\/p>\n<pre class=\"lang:default decode:true\">[root@test install]# wget http:\/\/downloads.sourceforge.net\/mysql-python\/MySQL-python-1.2.3.tar.gz\r\n[root@test install]# tar zxvf MySQL-python-1.2.3.tar.gz\r\n[root@test install]# whereis mysql_config\r\nmysql_config: \/usr\/bin\/mysql_config \/usr\/share\/man\/man1\/mysql_config.1.gz\r\n[root@test install]# cd MySQL-python-1.2.3\r\n[root@test install]# vi site.cfg\r\n# The path to mysql_config.\r\n# Only use this if mysql_config is not on your PATH, or you have some weird\r\n# setup that requires it.\r\nmysql_config = \/usr\/bin\/mysql_config\r\n\r\n[root@test install]# python setup.py build\r\n[root@test install]# python setup.py install\r\n<\/pre>\n<p>\uc124\uce58 \ub05d!!<br \/>\n\u00a0<br \/>\nmysql \uc811\uc18d\uc774 \uc815\uc0c1\uc801\uc73c\ub85c \uc798 \ub418\ub294\uc9c0 \ud14c\uc2a4\ud2b8 \ud504\ub85c\uadf8\ub7a8\uc744 \uc791\uc131.<\/p>\n<pre class=\"lang:python decode:true\">\r\n[root@test install]# vi test_mysql.py\r\nimport MySQLdb\r\n\r\ndb=MySQLdb.connect(host=\"localhost\",user=\"userid\",passwd=\"passwd\",db=\"test\")\r\ndb.query(\"\"\"select * from test\"\"\")\r\nr=db.store_result()\r\n\r\nprint(r.fetch_row())\r\nprint(r.fetch_row())\r\nprint(r.fetch_row())\r\n<\/pre>\n<p>\ud14c\uc2a4\ud2b8 \ud504\ub85c\uadf8\ub7a8(test_mysql.py) \uad6c\ub3d9<\/p>\n<pre class=\"lang:default decode:true\">\r\n[root@test install]# python test_mysql.py\r\n((1L, '20121024'),)\r\n((2L, '20121023'),)\r\n((3L, '20121024'),)\u00a0<\/pre>\n<p>GoooooD!!<br \/>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; \uc124\uce58 \ud558\uae30 \uc804\uc5d0 python \ubc84\uc804\uc744 \ud655\uc778. [root@test install]# python -V Python 2.4.3 MySQL-python \uc744 \uc0ac\uc6a9\ud558\ub824\uace0 \ud558\ub294\ub370, MySQL-python \uc740 2.4-2.7\ubc84\uc804\uc744 \uc9c0\uc6d0. http:\/\/sourceforge.net\/projects\/mysql-python\/ \uc758 \uc544\ub798\ubd80\ubd84 \ucc38\uace0. * Python versions 2.4-2.7; Python 3 support coming soon. \ud544\uc694\ud55c \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \uc124\uce58. [root@test install]# yum &hellip; <a href=\"https:\/\/apollo89.com\/wordpress\/?p=576\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[663],"tags":[90,41,140],"class_list":["post-576","post","type-post","status-publish","format-standard","hentry","category-python-","tag-mysql","tag-41","tag-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>python mysql \uc5f0\ub3d9 - Apollo89.com<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/apollo89.com\/wordpress\/?p=576\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"python mysql \uc5f0\ub3d9 - Apollo89.com\" \/>\n<meta property=\"og:description\" content=\"&nbsp; \uc124\uce58 \ud558\uae30 \uc804\uc5d0 python \ubc84\uc804\uc744 \ud655\uc778. [root@test install]# python -V Python 2.4.3 MySQL-python \uc744 \uc0ac\uc6a9\ud558\ub824\uace0 \ud558\ub294\ub370, MySQL-python \uc740 2.4-2.7\ubc84\uc804\uc744 \uc9c0\uc6d0. http:\/\/sourceforge.net\/projects\/mysql-python\/ \uc758 \uc544\ub798\ubd80\ubd84 \ucc38\uace0. * Python versions 2.4-2.7; Python 3 support coming soon. \ud544\uc694\ud55c \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \uc124\uce58. [root@test install]# yum &hellip; Continue reading &rarr;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/apollo89.com\/wordpress\/?p=576\" \/>\n<meta property=\"og:site_name\" content=\"Apollo89.com\" \/>\n<meta property=\"article:published_time\" content=\"2012-10-29T01:57:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-02-21T03:12:18+00:00\" \/>\n<meta name=\"author\" content=\"apollo89\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"apollo89\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"1\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/apollo89.com\\\/wordpress\\\/?p=576#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/apollo89.com\\\/wordpress\\\/?p=576\"},\"author\":{\"name\":\"apollo89\",\"@id\":\"https:\\\/\\\/apollo89.com\\\/wordpress\\\/#\\\/schema\\\/person\\\/93f56825cac3b2f18e5f107995066c82\"},\"headline\":\"python mysql \uc5f0\ub3d9\",\"datePublished\":\"2012-10-29T01:57:59+00:00\",\"dateModified\":\"2013-02-21T03:12:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/apollo89.com\\\/wordpress\\\/?p=576\"},\"wordCount\":31,\"commentCount\":1,\"keywords\":[\"mysql\",\"\uc124\uce58\",\"\ud30c\uc774\uc36c\"],\"articleSection\":[\"Python\\\/Ruby\\\/Perl\"],\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/apollo89.com\\\/wordpress\\\/?p=576#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/apollo89.com\\\/wordpress\\\/?p=576\",\"url\":\"https:\\\/\\\/apollo89.com\\\/wordpress\\\/?p=576\",\"name\":\"python mysql \uc5f0\ub3d9 - Apollo89.com\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/apollo89.com\\\/wordpress\\\/#website\"},\"datePublished\":\"2012-10-29T01:57:59+00:00\",\"dateModified\":\"2013-02-21T03:12:18+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/apollo89.com\\\/wordpress\\\/#\\\/schema\\\/person\\\/93f56825cac3b2f18e5f107995066c82\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/apollo89.com\\\/wordpress\\\/?p=576#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/apollo89.com\\\/wordpress\\\/?p=576\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/apollo89.com\\\/wordpress\\\/?p=576#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\\\/\\\/apollo89.com\\\/wordpress\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"python mysql \uc5f0\ub3d9\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/apollo89.com\\\/wordpress\\\/#website\",\"url\":\"https:\\\/\\\/apollo89.com\\\/wordpress\\\/\",\"name\":\"Apollo89.com\",\"description\":\"\uc544\ud3f4\ub85c\uc528\uc758 \uc7a1\ub2e4\ud55c \uacbd\ud5d8\ub4e4..\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/apollo89.com\\\/wordpress\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/apollo89.com\\\/wordpress\\\/#\\\/schema\\\/person\\\/93f56825cac3b2f18e5f107995066c82\",\"name\":\"apollo89\",\"description\":\"\uc544\ud3f4\ub85c89 \uc785\ub2c8\ub2e4.\",\"url\":\"https:\\\/\\\/apollo89.com\\\/wordpress\\\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"python mysql \uc5f0\ub3d9 - Apollo89.com","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/apollo89.com\/wordpress\/?p=576","og_locale":"ko_KR","og_type":"article","og_title":"python mysql \uc5f0\ub3d9 - Apollo89.com","og_description":"&nbsp; \uc124\uce58 \ud558\uae30 \uc804\uc5d0 python \ubc84\uc804\uc744 \ud655\uc778. [root@test install]# python -V Python 2.4.3 MySQL-python \uc744 \uc0ac\uc6a9\ud558\ub824\uace0 \ud558\ub294\ub370, MySQL-python \uc740 2.4-2.7\ubc84\uc804\uc744 \uc9c0\uc6d0. http:\/\/sourceforge.net\/projects\/mysql-python\/ \uc758 \uc544\ub798\ubd80\ubd84 \ucc38\uace0. * Python versions 2.4-2.7; Python 3 support coming soon. \ud544\uc694\ud55c \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \uc124\uce58. [root@test install]# yum &hellip; Continue reading &rarr;","og_url":"https:\/\/apollo89.com\/wordpress\/?p=576","og_site_name":"Apollo89.com","article_published_time":"2012-10-29T01:57:59+00:00","article_modified_time":"2013-02-21T03:12:18+00:00","author":"apollo89","twitter_card":"summary_large_image","twitter_misc":{"\uae00\uc4f4\uc774":"apollo89","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"1\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/apollo89.com\/wordpress\/?p=576#article","isPartOf":{"@id":"https:\/\/apollo89.com\/wordpress\/?p=576"},"author":{"name":"apollo89","@id":"https:\/\/apollo89.com\/wordpress\/#\/schema\/person\/93f56825cac3b2f18e5f107995066c82"},"headline":"python mysql \uc5f0\ub3d9","datePublished":"2012-10-29T01:57:59+00:00","dateModified":"2013-02-21T03:12:18+00:00","mainEntityOfPage":{"@id":"https:\/\/apollo89.com\/wordpress\/?p=576"},"wordCount":31,"commentCount":1,"keywords":["mysql","\uc124\uce58","\ud30c\uc774\uc36c"],"articleSection":["Python\/Ruby\/Perl"],"inLanguage":"ko-KR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/apollo89.com\/wordpress\/?p=576#respond"]}]},{"@type":"WebPage","@id":"https:\/\/apollo89.com\/wordpress\/?p=576","url":"https:\/\/apollo89.com\/wordpress\/?p=576","name":"python mysql \uc5f0\ub3d9 - Apollo89.com","isPartOf":{"@id":"https:\/\/apollo89.com\/wordpress\/#website"},"datePublished":"2012-10-29T01:57:59+00:00","dateModified":"2013-02-21T03:12:18+00:00","author":{"@id":"https:\/\/apollo89.com\/wordpress\/#\/schema\/person\/93f56825cac3b2f18e5f107995066c82"},"breadcrumb":{"@id":"https:\/\/apollo89.com\/wordpress\/?p=576#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/apollo89.com\/wordpress\/?p=576"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/apollo89.com\/wordpress\/?p=576#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/apollo89.com\/wordpress"},{"@type":"ListItem","position":2,"name":"python mysql \uc5f0\ub3d9"}]},{"@type":"WebSite","@id":"https:\/\/apollo89.com\/wordpress\/#website","url":"https:\/\/apollo89.com\/wordpress\/","name":"Apollo89.com","description":"\uc544\ud3f4\ub85c\uc528\uc758 \uc7a1\ub2e4\ud55c \uacbd\ud5d8\ub4e4..","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/apollo89.com\/wordpress\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Person","@id":"https:\/\/apollo89.com\/wordpress\/#\/schema\/person\/93f56825cac3b2f18e5f107995066c82","name":"apollo89","description":"\uc544\ud3f4\ub85c89 \uc785\ub2c8\ub2e4.","url":"https:\/\/apollo89.com\/wordpress\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/apollo89.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/576","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/apollo89.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/apollo89.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/apollo89.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/apollo89.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=576"}],"version-history":[{"count":0,"href":"https:\/\/apollo89.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/576\/revisions"}],"wp:attachment":[{"href":"https:\/\/apollo89.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=576"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/apollo89.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=576"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/apollo89.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=576"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}