- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
使用 MySQL 我无法使用加载数据本地 infile 导入文件。我的服务器在 AWS RDS 上。这适用于 Ubuntu 10.04。我使用 apt-get install mysql-client
安装了客户端。如果我在 Python 中使用 mysqldb 或 mysql.connector,也会出现同样的错误。
File "/usr/lib/pymodules/python2.7/mysql/connector/protocol.py", line 479, in cmd_query
return self.handle_cmd_result(self.conn.recv())
File "/usr/lib/pymodules/python2.7/mysql/connector/connection.py", line 179, in recv_plain
errors.raise_error(buf)
File "/usr/lib/pymodules/python2.7/mysql/connector/errors.py", line 82, in raise_error
raise get_mysql_exception(errno,errmsg)
mysql.connector.errors.NotSupportedError: 1148: The used command is not allowed with this MySQL version
我有很多数据要上传...我不敢相信 12.04 不受支持,我必须使用 12.04。
最佳答案
这不是真正的 python 问题...但总而言之,由 Ubuntu > 12.04 编译和分发的 mysql 不支持直接从 load data local infile
使用mysql 客户端。
如果您在 MySQL 引用文档中搜索错误 1148,请在上面链接的页面下方,在评论中:
Posted by Aaron Peterson on November 9 2005 4:35pm
With a defalut installation from FreeBSD ports, I had to use the command line mysql -u user -p --local-infile menagerie to start the mysql monitor, else the LOAD DATA LOCAL command failed with an error like the following:
ERROR 1148 (42000): The used command is not allowed with this MySQL version
...确实有效。
monte@oobun2:~$ mysql -h localhost -u monte -p monte --local-infile
Enter password:
...
mysql> LOAD DATA LOCAL INFILE 'pet.txt' INTO TABLE pet;
Query OK, 8 rows affected (0.04 sec)
Records: 8 Deleted: 0 Skipped: 0 Warnings: 0
mysql> SELECT * FROM pet;
+----------+--------+---------+------+------------+------------+
| name | owner | species | sex | birth | death |
+----------+--------+---------+------+------------+------------+
| Fluffy | Harold | cat | f | 1993-02-04 | NULL |
| Claws | Gwen | cat | m | 1994-03-17 | NULL |
| Buffy | Harold | dog | f | 1989-05-13 | NULL |
| Fang | Benny | dog | m | 1990-08-27 | NULL |
| Bowser | Diane | dog | m | 1979-08-31 | 1995-07-29 |
| Chirpy | Gwen | bird | f | 1998-09-11 | NULL |
| Whistler | Gwen | bird | NULL | 1997-12-09 | NULL |
| Slim | Benny | snake | m | 1996-04-29 | NULL |
| Puffball | Diane | hamster | f | 1999-03-30 | NULL |
+----------+--------+---------+------+------------+------------+
9 rows in set (0.00 sec)
mysql>
我一般不需要通过代码加载数据,所以这足以满足我的需求。如果您这样做,并且有能力/权限编辑您的 mysql 配置文件,那么相应部分中的 local-infile=1
行可能会更简单。
关于python - 加载数据本地 infile 在 Ubuntu 12.04 和 MySQL 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14011037/
我在阅读中看到这段代码: void assure(std::ifstream& infile ) { if(!infile) { /* stuff */} } 出于好奇,我使用函数参数类型 if
我想在 Load data Infile 中使用一个变量作为文件名。我运行以下代码: Set @d1 = 'C:/Users/name/Desktop/MySQL/1/'; Set @d2 = con
所以我只需要一些关于如何修复这个程序的指导,所以我需要阅读一个名为“infile.txt”的文件,文件里面是描述应该绘制的形状的说明(一个大写字符, 即 R,T,D,S,E) 然后它给出应该填充形状的
我在 Google App Engine 工作,我们有一个 Python 脚本可以将数据转储到 Google Cloud SQL 中。我们必须转储的数据集之一非常巨大。我们每天转储一次大约 150K
LOAD DATA INFILE 和 LOAD DATA LOCAL INFILE 有什么区别? 最佳答案 来自MySQL documentation : If LOCAL is specified,
我正在尝试使用以下命令将数据加载到现有的表中:MySQL>LOAD DATA LOCAL INFILE‘/PATH/loth.txt’INTO TABLE LOCAL;。但不断收到错误:错误2068(
我无法在我的服务器上使用导出功能。我已经尝试过搜索,但我能具体得到的并不多。我已经尝试了这两个功能,每次都会出现相同的错误。这是我得到的错误 ./phantomjs highcharts-conver
我目前正在解析一些网站以提高我的 Unix Bash 技能。已提取出一个具有以下格式的文件 la-que-no-podia-capitulo-1 la-que-no-podia-capitulo-25
尝试让 MySQL 在通过 INFILE 命令导入时忽略特定行。本质上,它是 CSV 文件中的“标题”行。 LOAD DATA LOCAL INFILE 'C:\myfile.txt' REPLACE
当我加载 infile 时遇到问题,其内容中包含 IP 地址, 在文件里面 [10] Mon 08Jul19 00:10:05 - (8457737) file "D:\a\b\c\file.zip"
如果这个问题重复,我深表歉意,但我发现的大多数问题都与 InnoDB 有关,而我正在使用 MyISAM。 我正在尝试创建一个进程,将 200-3 亿条记录加载到表中。我正在使用 LOAD DATA I
我在 mysql 数据库中加载数据时遇到问题。我用它作为在我的数据库中插入数据的方法: USE database; ALTER TABLE country ADD UNIQUE INDEX idx_n
我正在读取一个文件,并且在这个 .dat 文件的中间有一个标记。第一部分是变量和它们要分配的值。我正在获取变量及其值。这是我的。 int main() { ifstream infile; strin
我有点把自己画在角落里,需要一些指导。我在从 infstream 读取时使用正则表达式进行一些解析。我想做的是 while(getLine(inFile, str)) { search(st
我有一个名为 /tmp/files.txt 的文件,其结构如下: 652083 8 -rw-r--r-- 1 david staff
我正在构建一个接受这种格式的输入文件的程序: title author title author etc and outputs to screen title (author) title (aut
我为客户创建了一个 csv 文件导入器,我遇到的问题是我在文件中得到了十进制值的截断值,例如: in .csv file price is 12,23 and in database it is sa
我有一个 TSV,我正试图将其写入 mySQL 表中。几列是时间格式,但它们与 HH:MM:SS 的标准时间格式不匹配,而是看起来像 HH:MM AM/PM 我看过使用 PHP 执行此操作的示例,但我
我试图将 LOAD DATA INFILE 用作存储过程,但它似乎无法完成。然后我尝试了像这样将代码嵌入到应用程序本身的常用方法, conn = new MySqlConnection(connStr
如何在远程数据库(不同机器)上使用本地文件执行以下命令? $MYSQL_PATH/mysql -u root -h remote.net files -e " LOAD DATA INFILE
我是一名优秀的程序员,十分优秀!