본문 바로가기

개발자

The used command is not allowed with this MySQL version 에러 해결방법

반응형




The used command is not allowed with this MySQL version 에러 해결방법


아래와 같이 sql 문을 불러서 사용할 때 에러가 난다.


mysql> source loadstudent.sql

ERROR 1148 (42000): The used command is not allowed with this MySQL version


해결방법

1. mysql 접속시 --local-infile=1 옵션 추가

    mysql -u root -p --local-infile=1 database


  그러니까 실행할 때 위와 같이 명령어를 줍니다. root 는 사용자 이름, 맨 뒤에 데이터베이스는 db이름 입니다.


2.  local 키워드 제외

$ mysql>LOAD DATA INFILE 'test.csv' INTO TABLE tablename FIELDS TERMINATED BY ','; 


3. my.cnf 설정 변경

[mysql]

local-infile=1


3번 my.cnf 위치는 아래 명령어로 확인합니다. 맨 아래 파일 위치가 나오는데 그 파일을 찾아서 수정하시면 됩니다.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
pi@raspberrypi:~/dbtest $ mysqld --verbose --help | grep -1 'Default options'
180320 11:06:02 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
180320 11:06:02 [Note] mysqld (mysqld 5.5.50-0+deb8u1) starting as process 23084 ...
180320 11:06:03 [Warning] Can't create test file /var/lib/mysql/raspberrypi.lower-test
180320 11:06:03 [Warning] Can't create test file /var/lib/mysql/raspberrypi.lower-test
mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13)
180320 11:06:03 [Warning] One can only use the --user switch if running as root
180320 11:06:03 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
180320 11:06:03 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Table 'mysql.plugin' doesn't exist
180320 11:06:03 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf
pi@raspberrypi:~/dbtest $
cs


mysql 실행할때 위 명령어로 들어가니 잘 됩니다.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
pi@raspberrypi:~/dbtest $ mysql -u root ---local-infile demo
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 50
Server version: 5.5.50-0+deb8u1 (Raspbian)
 
Copyright (c) 20002016, Oracle and/or its affiliates. All rights reserved.
 
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
mysql> source loadstudent.sql
Query OK, 9 rows affected, 3 warnings (0.01 sec)
Records: 9  Deleted: 0  Skipped: 0  Warnings: 3
 
mysql> select * from student
    -> ;
+-------+--------------+-----------+-----------+
| scode | sname        | sdept     | sphone    |
+-------+--------------+-----------+-----------+
|       | NULL         | NULL      | NULL      |
| S001  |  fdfasasXy   |  computer |  123-4567 |
| S002  |  gsfgsdfdsfy |  computer |  123-4567 |
| S003  |  sssssssssy  |  computer |  123-4567 |
| S004  |  gggggggggXy |  computer |  123-4567 |
| S005  |  tttttXy     |  computer |  123-4567 |
| S006  |  aaaaaaaXy   |  computer |  123-4567 |
| S007  |  adfasdsy    |  computer |  123-4567 |
| S008  |  fdfasasXy   |  computer |  123-4567 |
+-------+--------------+-----------+-----------+
9 rows in set (0.00 sec)
 
cs

 






반응형

캐어랩 고객 지원

취업, 창업의 막막함, 외주 관리, 제품 부재!

당신의 고민은 무엇입니까? 현실과 동떨어진 교육, 실패만 반복하는 외주 계약, 아이디어는 있지만 구현할 기술이 없는 막막함.

우리는 알고 있습니다. 문제의 원인은 '명확한 학습, 실전 경험과 신뢰할 수 있는 기술력의 부재'에서 시작됩니다.

이제 고민을 멈추고, 캐어랩을 만나세요!

코딩(펌웨어), 전자부품과 디지털 회로설계, PCB 설계 제작, 고객(시장/수출) 발굴과 마케팅 전략으로 당신을 지원합니다.

제품 설계의 고수는 성공이 만든 게 아니라 실패가 만듭니다. 아이디어를 양산 가능한 제품으로!

귀사의 제품을 만드세요. 교육과 개발 실적으로 신뢰할 수 있는 파트너를 확보하세요.

지난 30년 여정, 캐어랩이 얻은 모든 것을 함께 나누고 싶습니다.

카카오 채널 추가하기

카톡 채팅방에서 무엇이든 물어보세요

당신의 성공을 위해 캐어랩과 함께 하세요.

캐어랩 온라인 채널 바로가기

캐어랩