{"id":14795,"date":"2011-04-27T10:01:06","date_gmt":"2011-04-27T08:01:06","guid":{"rendered":"https:\/\/mamchenkov.net\/wordpress\/?p=14795"},"modified":"2011-04-27T10:01:06","modified_gmt":"2011-04-27T08:01:06","slug":"mysql-export-csv-into-outfile-triggers-access-denied-error","status":"publish","type":"post","link":"https:\/\/mamchenkov.net\/wordpress\/2011\/04\/27\/mysql-export-csv-into-outfile-triggers-access-denied-error\/","title":{"rendered":"MySQL export CSV into OUTFILE triggers &#8220;access denied&#8221; error"},"content":{"rendered":"<!-- google_ad_section_start -->\n<p>I came across a weird problem today. \u00a0Gladly, the web is full of solutions, but I&#8217;m going to post this anyway, just to have it nearby for the next time. \u00a0I needed to export the results of some query into a CSV file directly from MySQL. \u00a0I prepared my query, made sure that I can see the correct results and than changed it to export into the file. The query looked something like this:<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nSELECT id, field1, field2, field3\r\nINTO OUTFILE '\/tmp\/data.csv'\r\nFIELDS TERMINATED BY ','\r\nOPTIONALLY ENCLOSED BY '&quot;'\r\nESCAPED BY '\\\\'\r\nLINES TERMINATED BY '\\n'\r\nFROM data_table\r\nWHERE field1 = 0;\r\n<\/pre>\n<p>I was quite surprised to find myself staring at:<\/p>\n<blockquote><p>ERROR 1045 (28000): Access denied for user &#8216;db_user&#8217;@&#8217;localhost&#8217; (using password: YES)<\/p><\/blockquote>\n<p>My database user definitely had full access to the database. \u00a0I definitely could see the results of the query before the redirect to the file. \u00a0And I definitely had enough permissions to create files in <em>\/tmp<\/em> directory. \u00a0And on top of that, I&#8217;m sure I used MySQL export functionality a gadzillion times and it always worked without any problems. \u00a0 What&#8217;s wrong this time?<\/p>\n<p>A quick search around got me to <a href=\"http:\/\/stackoverflow.com\/questions\/2449133\/access-denied-error-on-select-into-outfile-using-zend\">this Stack Overflow question<\/a>. \u00a0Apparently, database user has to be given a FILE\u00a0privilege, which is global (not per-database). \u00a0 Here is what I did to solve the problem (you&#8217;ll need to use MySQL root user of course):<\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nUSE mysql;\r\nUPDATE user SET File_priv = 'Y' WHERE User = 'db_user';\r\nFLUSH PRIVILEGES;\r\n<\/pre>\n<p>I think that it worked for me before was because I exported as root, who does have this permission set to &#8216;Y&#8217;.<\/p>\n<!-- google_ad_section_end -->\n","protected":false},"excerpt":{"rendered":"<!-- google_ad_section_start -->\n<p>I came across a weird problem today. \u00a0Gladly, the web is full of solutions, but I&#8217;m going to post this anyway, just to have it nearby for the next time. \u00a0I needed to export the results of some query into a CSV file directly from MySQL. \u00a0I prepared my query, made sure that I can &hellip; <a href=\"https:\/\/mamchenkov.net\/wordpress\/2011\/04\/27\/mysql-export-csv-into-outfile-triggers-access-denied-error\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">MySQL export CSV into OUTFILE triggers &#8220;access denied&#8221; error<\/span><\/a><\/p>\n<!-- google_ad_section_end -->\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false,"_links_to":"","_links_to_target":""},"categories":[1,18,133,62],"tags":[1559,3066,200],"keyring_services":[],"class_list":["post-14795","post","type-post","status-publish","format-standard","hentry","category-general","category-programming","category-sysadmin","category-technology","tag-databases","tag-mysql","tag-security"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"description\" content=\"I came across a weird problem today. Gladly, the web is full of solutions, but I&#039;m going to post this anyway, just to have it nearby for the next time. I needed to export the results of some query into a CSV file directly from MySQL. I prepared my query, made sure that I can\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Leonid Mamchenkov\"\/>\n\t<meta name=\"google-site-verification\" content=\"VHvdD0_usx1_4DzKy_QCVcICVgX2EgA2ybELT-wl7kQ\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/mamchenkov.net\/wordpress\/2011\/04\/27\/mysql-export-csv-into-outfile-triggers-access-denied-error\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Leonid Mamchenkov - Life, universe, and everything else\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"MySQL export CSV into OUTFILE triggers \u201caccess denied\u201d error - Leonid Mamchenkov\" \/>\n\t\t<meta property=\"og:description\" content=\"I came across a weird problem today. Gladly, the web is full of solutions, but I&#039;m going to post this anyway, just to have it nearby for the next time. I needed to export the results of some query into a CSV file directly from MySQL. I prepared my query, made sure that I can\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/mamchenkov.net\/wordpress\/2011\/04\/27\/mysql-export-csv-into-outfile-triggers-access-denied-error\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2011-04-27T08:01:06+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2011-04-27T08:01:06+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/MamchenkovBlog\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@mamchenkov\" \/>\n\t\t<meta name=\"twitter:title\" content=\"MySQL export CSV into OUTFILE triggers \u201caccess denied\u201d error - Leonid Mamchenkov\" \/>\n\t\t<meta name=\"twitter:description\" content=\"I came across a weird problem today. Gladly, the web is full of solutions, but I&#039;m going to post this anyway, just to have it nearby for the next time. I needed to export the results of some query into a CSV file directly from MySQL. I prepared my query, made sure that I can\" \/>\n\t\t<meta name=\"twitter:creator\" content=\"@mamchenkov\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2011\\\/04\\\/27\\\/mysql-export-csv-into-outfile-triggers-access-denied-error\\\/#blogposting\",\"name\":\"MySQL export CSV into OUTFILE triggers \\u201caccess denied\\u201d error - Leonid Mamchenkov\",\"headline\":\"MySQL export CSV into OUTFILE triggers &#8220;access denied&#8221; error\",\"author\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2011\\\/04\\\/27\\\/mysql-export-csv-into-outfile-triggers-access-denied-error\\\/#articleImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g\",\"width\":96,\"height\":96,\"caption\":\"Leonid Mamchenkov\"},\"datePublished\":\"2011-04-27T10:01:06+02:00\",\"dateModified\":\"2011-04-27T10:01:06+02:00\",\"inLanguage\":\"en-US\",\"commentCount\":6,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2011\\\/04\\\/27\\\/mysql-export-csv-into-outfile-triggers-access-denied-error\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2011\\\/04\\\/27\\\/mysql-export-csv-into-outfile-triggers-access-denied-error\\\/#webpage\"},\"articleSection\":\"All, Programming, Sysadmin, Technology, databases, MySQL, security\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2011\\\/04\\\/27\\\/mysql-export-csv-into-outfile-triggers-access-denied-error\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/#listItem\",\"position\":2,\"name\":\"Technology\",\"item\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/programming\\\/#listItem\",\"name\":\"Programming\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/programming\\\/#listItem\",\"position\":3,\"name\":\"Programming\",\"item\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/programming\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2011\\\/04\\\/27\\\/mysql-export-csv-into-outfile-triggers-access-denied-error\\\/#listItem\",\"name\":\"MySQL export CSV into OUTFILE triggers &#8220;access denied&#8221; error\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2011\\\/04\\\/27\\\/mysql-export-csv-into-outfile-triggers-access-denied-error\\\/#listItem\",\"position\":4,\"name\":\"MySQL export CSV into OUTFILE triggers &#8220;access denied&#8221; error\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/programming\\\/#listItem\",\"name\":\"Programming\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#person\",\"name\":\"Leonid Mamchenkov\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2011\\\/04\\\/27\\\/mysql-export-csv-into-outfile-triggers-access-denied-error\\\/#personImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g\",\"width\":96,\"height\":96,\"caption\":\"Leonid Mamchenkov\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/#author\",\"url\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/\",\"name\":\"Leonid Mamchenkov\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2011\\\/04\\\/27\\\/mysql-export-csv-into-outfile-triggers-access-denied-error\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g\",\"width\":96,\"height\":96,\"caption\":\"Leonid Mamchenkov\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2011\\\/04\\\/27\\\/mysql-export-csv-into-outfile-triggers-access-denied-error\\\/#webpage\",\"url\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2011\\\/04\\\/27\\\/mysql-export-csv-into-outfile-triggers-access-denied-error\\\/\",\"name\":\"MySQL export CSV into OUTFILE triggers \\u201caccess denied\\u201d error - Leonid Mamchenkov\",\"description\":\"I came across a weird problem today. Gladly, the web is full of solutions, but I'm going to post this anyway, just to have it nearby for the next time. I needed to export the results of some query into a CSV file directly from MySQL. I prepared my query, made sure that I can\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2011\\\/04\\\/27\\\/mysql-export-csv-into-outfile-triggers-access-denied-error\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/#author\"},\"datePublished\":\"2011-04-27T10:01:06+02:00\",\"dateModified\":\"2011-04-27T10:01:06+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#website\",\"url\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/\",\"name\":\"Blog of Leonid Mamchenkov\",\"description\":\"Life, universe, and everything else\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"MySQL export CSV into OUTFILE triggers \u201caccess denied\u201d error - Leonid Mamchenkov","description":"I came across a weird problem today. Gladly, the web is full of solutions, but I'm going to post this anyway, just to have it nearby for the next time. I needed to export the results of some query into a CSV file directly from MySQL. I prepared my query, made sure that I can","canonical_url":"https:\/\/mamchenkov.net\/wordpress\/2011\/04\/27\/mysql-export-csv-into-outfile-triggers-access-denied-error\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"google-site-verification":"VHvdD0_usx1_4DzKy_QCVcICVgX2EgA2ybELT-wl7kQ","miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/mamchenkov.net\/wordpress\/2011\/04\/27\/mysql-export-csv-into-outfile-triggers-access-denied-error\/#blogposting","name":"MySQL export CSV into OUTFILE triggers \u201caccess denied\u201d error - Leonid Mamchenkov","headline":"MySQL export CSV into OUTFILE triggers &#8220;access denied&#8221; error","author":{"@id":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/#author"},"publisher":{"@id":"https:\/\/mamchenkov.net\/wordpress\/#person"},"image":{"@type":"ImageObject","@id":"https:\/\/mamchenkov.net\/wordpress\/2011\/04\/27\/mysql-export-csv-into-outfile-triggers-access-denied-error\/#articleImage","url":"https:\/\/secure.gravatar.com\/avatar\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g","width":96,"height":96,"caption":"Leonid Mamchenkov"},"datePublished":"2011-04-27T10:01:06+02:00","dateModified":"2011-04-27T10:01:06+02:00","inLanguage":"en-US","commentCount":6,"mainEntityOfPage":{"@id":"https:\/\/mamchenkov.net\/wordpress\/2011\/04\/27\/mysql-export-csv-into-outfile-triggers-access-denied-error\/#webpage"},"isPartOf":{"@id":"https:\/\/mamchenkov.net\/wordpress\/2011\/04\/27\/mysql-export-csv-into-outfile-triggers-access-denied-error\/#webpage"},"articleSection":"All, Programming, Sysadmin, Technology, databases, MySQL, security"},{"@type":"BreadcrumbList","@id":"https:\/\/mamchenkov.net\/wordpress\/2011\/04\/27\/mysql-export-csv-into-outfile-triggers-access-denied-error\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress#listItem","position":1,"name":"Home","item":"https:\/\/mamchenkov.net\/wordpress","nextItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/#listItem","name":"Technology"}},{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/#listItem","position":2,"name":"Technology","item":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/programming\/#listItem","name":"Programming"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/programming\/#listItem","position":3,"name":"Programming","item":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/programming\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/2011\/04\/27\/mysql-export-csv-into-outfile-triggers-access-denied-error\/#listItem","name":"MySQL export CSV into OUTFILE triggers &#8220;access denied&#8221; error"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/#listItem","name":"Technology"}},{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/2011\/04\/27\/mysql-export-csv-into-outfile-triggers-access-denied-error\/#listItem","position":4,"name":"MySQL export CSV into OUTFILE triggers &#8220;access denied&#8221; error","previousItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/programming\/#listItem","name":"Programming"}}]},{"@type":"Person","@id":"https:\/\/mamchenkov.net\/wordpress\/#person","name":"Leonid Mamchenkov","image":{"@type":"ImageObject","@id":"https:\/\/mamchenkov.net\/wordpress\/2011\/04\/27\/mysql-export-csv-into-outfile-triggers-access-denied-error\/#personImage","url":"https:\/\/secure.gravatar.com\/avatar\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g","width":96,"height":96,"caption":"Leonid Mamchenkov"}},{"@type":"Person","@id":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/#author","url":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/","name":"Leonid Mamchenkov","image":{"@type":"ImageObject","@id":"https:\/\/mamchenkov.net\/wordpress\/2011\/04\/27\/mysql-export-csv-into-outfile-triggers-access-denied-error\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g","width":96,"height":96,"caption":"Leonid Mamchenkov"}},{"@type":"WebPage","@id":"https:\/\/mamchenkov.net\/wordpress\/2011\/04\/27\/mysql-export-csv-into-outfile-triggers-access-denied-error\/#webpage","url":"https:\/\/mamchenkov.net\/wordpress\/2011\/04\/27\/mysql-export-csv-into-outfile-triggers-access-denied-error\/","name":"MySQL export CSV into OUTFILE triggers \u201caccess denied\u201d error - Leonid Mamchenkov","description":"I came across a weird problem today. Gladly, the web is full of solutions, but I'm going to post this anyway, just to have it nearby for the next time. I needed to export the results of some query into a CSV file directly from MySQL. I prepared my query, made sure that I can","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/mamchenkov.net\/wordpress\/#website"},"breadcrumb":{"@id":"https:\/\/mamchenkov.net\/wordpress\/2011\/04\/27\/mysql-export-csv-into-outfile-triggers-access-denied-error\/#breadcrumblist"},"author":{"@id":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/#author"},"creator":{"@id":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/#author"},"datePublished":"2011-04-27T10:01:06+02:00","dateModified":"2011-04-27T10:01:06+02:00"},{"@type":"WebSite","@id":"https:\/\/mamchenkov.net\/wordpress\/#website","url":"https:\/\/mamchenkov.net\/wordpress\/","name":"Blog of Leonid Mamchenkov","description":"Life, universe, and everything else","inLanguage":"en-US","publisher":{"@id":"https:\/\/mamchenkov.net\/wordpress\/#person"}}]},"og:locale":"en_US","og:site_name":"Leonid Mamchenkov - Life, universe, and everything else","og:type":"article","og:title":"MySQL export CSV into OUTFILE triggers \u201caccess denied\u201d error - Leonid Mamchenkov","og:description":"I came across a weird problem today. Gladly, the web is full of solutions, but I'm going to post this anyway, just to have it nearby for the next time. I needed to export the results of some query into a CSV file directly from MySQL. I prepared my query, made sure that I can","og:url":"https:\/\/mamchenkov.net\/wordpress\/2011\/04\/27\/mysql-export-csv-into-outfile-triggers-access-denied-error\/","og:image":"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg","og:image:secure_url":"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg","og:image:width":1024,"og:image:height":1024,"article:published_time":"2011-04-27T08:01:06+00:00","article:modified_time":"2011-04-27T08:01:06+00:00","article:publisher":"https:\/\/www.facebook.com\/MamchenkovBlog","twitter:card":"summary_large_image","twitter:site":"@mamchenkov","twitter:title":"MySQL export CSV into OUTFILE triggers \u201caccess denied\u201d error - Leonid Mamchenkov","twitter:description":"I came across a weird problem today. Gladly, the web is full of solutions, but I'm going to post this anyway, just to have it nearby for the next time. I needed to export the results of some query into a CSV file directly from MySQL. I prepared my query, made sure that I can","twitter:creator":"@mamchenkov","twitter:image":"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg"},"aioseo_meta_data":{"post_id":"14795","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"BlogPosting","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2023-07-19 19:18:56","updated":"2026-01-15 06:39:48","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/mamchenkov.net\/wordpress\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/\" title=\"Technology\">Technology<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/programming\/\" title=\"Programming\">Programming<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tMySQL export CSV into OUTFILE triggers \u201caccess denied\u201d error\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/mamchenkov.net\/wordpress"},{"label":"Technology","link":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/"},{"label":"Programming","link":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/programming\/"},{"label":"MySQL export CSV into OUTFILE triggers &#8220;access denied&#8221; error","link":"https:\/\/mamchenkov.net\/wordpress\/2011\/04\/27\/mysql-export-csv-into-outfile-triggers-access-denied-error\/"}],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":12480,"url":"https:\/\/mamchenkov.net\/wordpress\/2010\/04\/21\/unit-tests-with-cakephp\/","url_meta":{"origin":14795,"position":0},"title":"Unit tests with CakePHP","author":"Leonid Mamchenkov","date":"April 21, 2010","format":false,"excerpt":"I've spent a large part of yesterday setting up the testing environment for a CakePHP project.\u00a0 As always, every time I do something that I have done before, I wanted to do it better, using all the experienced that was acquired previously.\u00a0 And this often leads to the discovery of\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":20769,"url":"https:\/\/mamchenkov.net\/wordpress\/2014\/02\/19\/the-worst-typo-in-mysql-query-ever\/","url_meta":{"origin":14795,"position":1},"title":"The worst typo in MySQL query ever","author":"Leonid Mamchenkov","date":"February 19, 2014","format":false,"excerpt":"Well, today I've learned something new. \u00a0Typing a query like this: [code lang=\"sql\" light=\"1\"] UPDATE `table` SET `field` = '1' WHERE `id` = '123' [\/code] I made a typo and entered the following: [code lang=\"sql\" light=\"1\"] UPDATE `table` SET `field` = '1' WHERE `id` - '123' [\/code] Yup. \u00a0A simple\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":28414,"url":"https:\/\/mamchenkov.net\/wordpress\/2018\/02\/26\/top-10-mysql-8-0-features-for-dbas-ops\/","url_meta":{"origin":14795,"position":2},"title":"TOP 10 MySQL 8.0 features for DBAs &#038; OPS","author":"Leonid Mamchenkov","date":"February 26, 2018","format":false,"excerpt":"Here's a list of the TOP 10 MySQL 8.0 features for DBAs and OPS, with some detailed explanations of what they are and links to more information.\u00a0 The features covered are: Temporary Tables Improvements Persistent global variables No more InnoDB System Tables Reclaim UNDO space from large transactions UTF8 performance\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26926,"url":"https:\/\/mamchenkov.net\/wordpress\/2016\/11\/21\/monitoring-the-monitoring-keeping-zabbix-server-service-up\/","url_meta":{"origin":14795,"position":3},"title":"Monitoring the monitoring : keeping Zabbix server service up","author":"Leonid Mamchenkov","date":"November 21, 2016","format":false,"excerpt":"After our recent MySQL migrations, I started getting a weird issue - Zabbix server process was crashing periodically (several times a day). [code light=\"true\"] 8395:20161109:175408.023 [Z3005] query failed: [2013] Lost connection to MySQL server during query [begin;] 8395:20161109:175408.024 [Z3001] connection to database 'zabbix_database_name_here' failed: [2003] Can't connect to MySQL server\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26925,"url":"https:\/\/mamchenkov.net\/wordpress\/2016\/11\/21\/fixing-innodb-error-log-file-ib_logfile0-is-of-different-size\/","url_meta":{"origin":14795,"position":4},"title":"Fixing &#8220;InnoDB: Error: log file .\/ib_logfile0 is of different size&#8221;","author":"Leonid Mamchenkov","date":"November 21, 2016","format":false,"excerpt":"For the last few days I've been moving MySQL databases around at work. \u00a0Being a bit in a rush and overconfident (I have backups!), \u00a0I was simply detaching the \/var\/lib\/mysql volume on one host (running Amazon AMI and MySQL) and attaching it to another host (running CentOS 7 and MariaDB).\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":28562,"url":"https:\/\/mamchenkov.net\/wordpress\/2018\/05\/08\/database-flow-modern-self-hosted-web-interface-for-sql-and-graphql\/","url_meta":{"origin":14795,"position":5},"title":"Database Flow &#8211; modern, self-hosted web interface for SQL and GraphQL","author":"Leonid Mamchenkov","date":"May 8, 2018","format":false,"excerpt":"Database Flow is a modern, Open Source, self-hosted, web-based tool for working with SQL databases and GraphQL APIs.\u00a0 It supports a variety of the database engines: IBM DB2, Oracle, H2, PostgreSQL, MySQL, SQLite, Informix, and Microsoft SQL Server.\u00a0 It features an advanced SQL editor, query plan analyzer, GraphQL client, schema\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2018\/05\/database-flow-500x281.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/14795","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/comments?post=14795"}],"version-history":[{"count":0,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/14795\/revisions"}],"wp:attachment":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/media?parent=14795"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/categories?post=14795"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/tags?post=14795"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/keyring_services?post=14795"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}