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 -A 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 -p --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) 2000, 2016, 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 |
'개발자' 카테고리의 다른 글
| 나쁜 코드의 10가지 징후 10 SIGNS OF REALLY BAD CODE (0) | 2018.09.08 |
|---|---|
| Best websites for a programmer 프로그래머를 위한 온라인 학습 사이트 (0) | 2018.09.08 |
| ftdi serial to usb 케이블 Window10에서 인식 안되는 문제 (0) | 2018.03.27 |
| The elements of programming style 요약본 (0) | 2018.03.20 |
| 리눅스에 대한 소식과 좋은 자료가 가득한 사이트들 (0) | 2018.03.08 |
| User Interface Design and Programming - Books (0) | 2018.02.09 |
| 최고의 인터페이스 클라이네 원적외선 세라믹 레인지 전기레인지 (0) | 2018.02.01 |
| 컴퓨터 프로그래밍에 대한 명언 101가지 (0) | 2018.01.25 |
취업, 창업의 막막함, 외주 관리, 제품 부재!
당신의 고민은 무엇입니까? 현실과 동떨어진 교육, 실패만 반복하는 외주 계약,
아이디어는 있지만 구현할 기술이 없는 막막함.
우리는 알고 있습니다. 문제의 원인은 '명확한 학습, 실전 경험과 신뢰할 수 있는 기술력의 부재'에서 시작됩니다.
이제 고민을 멈추고, 캐어랩을 만나세요!
코딩(펌웨어), 전자부품과 디지털 회로설계, PCB 설계 제작, 고객(시장/수출) 발굴과 마케팅 전략으로 당신을 지원합니다.
제품 설계의 고수는 성공이 만든 게 아니라 실패가 만듭니다. 아이디어를 양산 가능한 제품으로!
귀사의 제품을 만드세요. 교육과 개발 실적으로 신뢰할 수 있는 파트너를 확보하세요.
캐어랩