Mysql Error Number 1148
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us the used command is not allowed with this mysql version php Learn more about Stack Overflow the company Business Learn more about hiring developers or
The Used Command Is Not Allowed With This Mariadb Version
posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow
Loose-local-infile=1
Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up How can I correct MySQL Load Error up vote
The Used Command Is Not Allowed With This Mysql Version Python
20 down vote favorite 8 I'm not quite sure a similar question to this was closed by I'm trying to execute the following MySQL program. mysql -e "load data local infile \ '/tmp/ept_inventory_wasp_export_04292013.csv' into \ table wasp_ept_inv fields terminated by ',' \ lines terminated by '\n' ;" at the bash command line and get this error ERROR 1148 (42000) at line 1: The used command is not security issues with load data local allowed with this MySQL version How can I work around this problem? I am actually running this command from a Python program, but pulled the command out to try fiddling with it at the bash command line. I've seen how I can modify my.cnf (local-infile), but I do not want that global a change if I can avoid it. Here's the MySQL version. mysql Ver 14.14 Distrib 5.5.31, for debian-linux-gnu (i686) using readline 6.2 mysql csv import load local share|improve this question edited Feb 4 at 12:05 shgnInc 96111023 asked Apr 29 '13 at 18:40 octopusgrabbus 5,57772882 add a comment| 4 Answers 4 active oldest votes up vote 26 down vote accepted As documented under Security Issues with LOAD DATA LOCAL: To deal with these problems, we changed how LOAD DATA LOCAL is handled as of MySQL 3.23.49 and MySQL 4.0.2 (4.0.13 on Windows): By default, all MySQL clients and libraries in binary distributions are compiled with the --enable-local-infile option, to be compatible with MySQL 3.23.48 and before. If you build MySQL from source but do not invoke configure with the --enable-local-infile option, LOAD DATA LOCAL cannot be used by any client unless it is written explicitly to invoke mysql_options(... MYSQL_OPT_LOCAL_INFI
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more load data local infile mysql 5.5 not allowed about Stack Overflow the company Business Learn more about hiring developers or posting ads pymysql local infile with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow can't get stat of (errcode 13) is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Error 1148 MySQL The used command is not allowed with this MySQL http://stackoverflow.com/questions/16285864/how-can-i-correct-mysql-load-error version up vote 10 down vote favorite 4 I am using MySQL LOAD DATA LOCAL INFILE command and I get this error: PDOException: SQLSTATE[42000]: Syntax error or access violation: 1148 The used command is not allowed with this MySQL version: LOAD DATA LOCAL INFILE '/tmp/phpI0ox54' INTO TABLE `dev_tmp` FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES; Array ( ) in dc_real_estate_form_submit() (line 147 http://stackoverflow.com/questions/12819098/error-1148-mysql-the-used-command-is-not-allowed-with-this-mysql-version of /PATH/TO/PHP/SCRIPT). What setting can we change to allow LOAD DATA LOCAL infile? Here is the Drupal 7 code we are using: $sql = "LOAD DATA LOCAL INFILE '".$file."' INTO TABLE `dev_tmp` FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\\r\\n' IGNORE 1 LINES"; db_query($sql); php mysql load-data-infile share|improve this question edited Jan 2 '14 at 21:33 Eric Leschinski 47k23221190 asked Oct 10 '12 at 12:13 Chris Muench 4,98241140243 1 It requires a new permission for a while now, perhaps that's the problem? –Ja͢ck Oct 10 '12 at 12:50 2 add --local-infile while invoking mysql. It works. Eg: mysql -h localhost --local-infile –nizam.sp Apr 9 '13 at 16:22 add a comment| 4 Answers 4 active oldest votes up vote 25 down vote Loading a local file in MySQL is a security hazard and is off by default, you want to leave it off if you can. When it is not permitted you get this error: ERROR 1148 (42000): The used command is not allowed with this MySQL version Solutions: Use --local-infile=1 argument on the mysql commandline: When you start MySQL on the terminal, include --local-infile=1 argument, Something like this: mysql --local-infile=1 -uroot -p mysql>LOAD DATA LOCAL INFILE '/tmp/foo.txt' INTO TABLE foo COLUMNS
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack http://stackoverflow.com/questions/25296720/load-data-local-infile-error-in-query-1148-the-used-command-is-not-allowed-wi Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up LOAD DATA LOCAL INFILE Error in query (1148): The used command is not allowed with not allowed this MySQL version up vote 0 down vote favorite I've seen this question asked about a dozen times and the answers that seem to work for everyone are the same: add local-infile = 1 to [mysql], [mysqld], and add [client] loose-local-infile=1 to my.conf. I've done all of that as well as adding file permission to my DB user for . and I still get the same error. I'm running MySQL 5.6 the used command on a virtual Ubuntu 14.04 server. Can anyone let me know what I'm missing? I've got this working successfully on my live server which is a VPS running CentOS and MySQL 5.6 as well and I don't remember having to jump through any hoops to get it working, though it was some time ago that I set it up. If it matters, I'm attempting this import through the below PHP function: // Connect to a database without using prepared statements (for LOAD FILE feed commands) // $query = query to execute; $rs = return a result set if true function db_query_unprepared($query, $rs = false) { // Create database connection $link = mysqli_connect(DB_SERVER, DB_USER, DB_PASS, DB_NAME); if (!$link) { print 'Error connecting to MySQL Server. Errorcode: ' . mysqli_connect_error(); exit; } // Execute the query if ($rs) { $queryresults = array(); $counter = 0; if (mysqli_multi_query($link, $query)) { do { // Save results to an array if ($result = mysqli_store_result($link)) { while ($row = mysqli_fetch_assoc($result)) { $queryresults[$counter][] = $row; } mysqli_free_result($result); $counter++; } } while (mysqli_next_result($link)); } else { print mysqli_error($link); } } else { mysqli_multi_query($link, $query); } mysqli_close($link); // Return the results if (isset($queryresults)) { return $queryresults; } } That in turn is called like so: db_query_unprepared('LOAD DATA LOCAL INFILE \'/path