일단 나는 Mac m1 사용자고 homebrew로 mysql을 설치했다.

 

문제상황

MySQL 실행중, 외부에서 csv 파일을 가져와 테이블에 insert하려고 할 때 아래 코드를 실행 시켰더니 에러가 발생했다.

load data infile '/Users/home/Team.csv'
into table Team
fields terminated by ';'
enclosed by ''
lines terminated by 'n'
ignore 1 rows;

 

에러문: ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement 

 

 

원인

M1 터미널에 MySQL을 설치한 뒤 아래 명령어를 사용해서 서버 관련 설정을 해주게 되는데,

$ mysql.server start

 

이때 --secure-file-priv 옵션을 설정해줘서 그렇다고 한다. 위 명령어를 터미널에 입력해 서버를 다시 시작하고, 옵션 설정을 다시 해주면 된다.

 

해결을 시도했으나 실패

서버 설정을 다시 해주려고 위의 명령어를 입력했지만 갑자기 아래와 같은 에러가 떴다. 

 

여기를 참고해서  다음 명령어를 시도했다.

// MySQL에 대한 소유 변경
$ sudo chown -R _mysql:_mysql /opt/homebrew/var/mysql
// MySQL 설치 위치 확인
$ brew --prefix mysql
// MySQL 및 폴더 권한 변경
$ sudo chmod -R 750 /opt/homebrew/opt/mysql
$ sudo chmod -R 750 /opt/homebrew/opt/

 

그러나......

 

해결 안돼서 그냥 여기를 참고해서 mysql을 삭제하고 재설치했다.

 

---

아무튼 다시 본론으로 돌아와서

 

해결 시도 1) infile 앞에 local을 붙여라

load data infile '/Users/yujimin/C:C++/Team.csv'
into table Team
fields terminated by ','
enclosed by ''
lines terminated by 'n'
ignore 1 rows;

 

응안돼~

 

해결 시도 2) my.cnf 파일에 "" 추가

아래 명령어로 my.cnf의 위치를 찾는다.

 

 

/opt/homebrew/etc/my.cnf

 

$ brew sercives restart mysql

 

 

 

???아또왜

 

에러 메시지

. ERROR! The server quit without updating PID file (/opt/homebrew/var/mysql/dhcp198.merusouth113.iit.edu.pid).

 

해결방법

$ sudo rm -rf /opt/homebrew/var/mysql/

$ brew reinstall mysql

$ mysql.server start

$ mysql_secure_installation 

Would you like to setup VALIDATE PASSWORD component? -> n

Remove anonymous users? -> y

Disallow root login remotely? -> n

Remove test database and access to it? -> n

Reload privilege tables now? -> n

 

All done!

 

mysql 실행

$ mysql -u root -p

비번입력하면

mysql> 창 뜨면서 시작~

 

 

ref: https://cocoze.tistory.com/93

1. homebrew 설치

$ brew -v	// homebrew 설치 여부 확인

Homebrew 4.2.10과 같이 설치 버전이 뜨면 설치되어있는 것이다.

설치가 안 되어있다면 설치해주자.

 

2. 아래 명령어를 순서대로 입력해서 mysql을 설치 및 시작한다.

$ brew install mysql

$ mysql.server start

$ mysel_secure_installation

 

3. 기본 설정 창이 뜬다. 상황에 맞게 y or n를 입력해준다. 나는 여기를 참고해서 똑같이 해줬다.

 

4. mysql 실행하기

$ mysql -u root -p

 

 

 

ref: https://velog.io/@haleyjun/MySQL-Mac%EC%97%90-MySQL-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0-M1%EC%B9%A9

데이터베이스 초보자는 설치 과정에서부터 난관에 봉착한다.

 

지금까지는 MySQL로 수업 내용을 커버해왔는데,

OLAP을 배우면서 CUBE라는 다차원 배열 데이터베이스에 대해 배우면서, MySQL에서는 지원하지 않는다는 것을 알게 되었다.

그래서 PostgreSQL을 설치한 뒤 'Initialize'를 눌렀더니

 

이런 경고문이 떴다.

 

해결 방법

먼저 터미널에 아래와 같이 입력한다. 5432 포트를 사용/수신대기 중인 프로세스에 대한 정보를 확인하는 명령어이다.

$ sudo lsof -i :5432

원인: postgress로 식별되는 다른 프로세스가 이미 5432 포트를 사용중이어서 위와 같은 에러가 발생했다.

 

해결: 터미널에 아래 명령어를 입력해 PostgreSQL 프로세스를 죽인다.

$ sudo pkill -u postgres

 

 

해결 ~

 

reference: https://dev.to/balt1794/postgresql-port-5432-already-in-use-1pcf

이 게시글에서는 아래 링크의 튜토리얼을 따라 M1에 openssl1.1.1을 설치할 때와 md5, sha1 소스코드를 컴파일할 때 겪은 문제를 정리한다.

https://indiespark.top/programming/compile-open-ssl-apple-silicon/

 

How to Compile OpenSSL 1.1.1 for Apple Silicon

The long-rumored ARM Mac is on the horizon. With this comes the big work of porting and re-compiling current applications. But many Mac App Store apps are dependent on OpenSSL, which doesn’t yet su…

indiespark.top

 

 

1. fatal error: 'inttypes.h' file not found

Building the ARM Half 단계에서 $ caffeniate make 을 입력했더니 다음과 같은 에러가 발생했다.

에러문

더보기

perl "-I." -Mconfigdata "util/dofile.pl" \
    "-oMakefile" include/crypto/bn_conf.h.in > include/crypto/bn_conf.h
perl "-I." -Mconfigdata "util/dofile.pl" \
    "-oMakefile" include/crypto/dso_conf.h.in > include/crypto/dso_conf.h
perl "-I." -Mconfigdata "util/dofile.pl" \
    "-oMakefile" include/openssl/opensslconf.h.in > include/openssl/opensslconf.h
/Applications/Xcode.app/Contents/Developer/usr/bin/make depend && /Applications/Xcode.app/Contents/Developer/usr/bin/make _all
cc  -I. -Iinclude -fPIC -arch arm64 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -O3 -Wall -DL_ENDIAN -DOPENSSL_PIC -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/usr/local/lib/engines-1.1\"" -D_REENTRANT -DZLIB -DNDEBUG  -MMD -MF apps/app_rand.d.tmp -MT apps/app_rand.o -c -o apps/app_rand.o apps/app_rand.c
clang: warning: no such sysroot directory: '/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
clang: warning: using sysroot for 'MacOSX' but targeting 'iPhone' [-Wincompatible-sysroot]
In file included from apps/app_rand.c:10:
In file included from apps/apps.h:13:
In file included from ./e_os.h:16:
In file included from include/openssl/e_os2.h:243:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/inttypes.h:21:15: fatal error: 'inttypes.h' file not found
#include_next 
              ^~~~~~~~~~~~
1 error generated.
make[1]: *** [apps/app_rand.o] Error 1
make: *** [all] Error 2

해결

"Xcode-beta.app"을 "Xcode.app"으로 수정하면 된다. 자세한 openssl 과정은 링크 참고.

"darwin64-arm64-cc" => {
    inherit_from     => [ "darwin-common", asm("aarch64_asm") ],
    CFLAGS           => add("-Wall"),
    cflags           => add("-arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"),
    lib_cppflags     => add("-DL_ENDIAN"),
    bn_ops           => "SIXTY_FOUR_BIT_LONG",
    perlasm_scheme   => "macosx",
},

 

 

2.  md5 관련 컴파일 에러

해결

아래 명령어를 입력해 경로를 변경 해준다.

export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl@3/lib/

그런데 이 경우 x86_64에서는 해결이 되는데 arm64에서는 여전히 에러다..

.

.

.

해결!!!!!했다!!!

 

원했던 것

arm64 아키텍처에서도 openssl라이브러리 사용한 c프로그램 정상 실행

 

c프로그램 컴파일 시 에러문

3 warnings generated. ld: warning: ignoring file /usr/local/opt/openssl/lib//libcrypto.dylib, 
building for macOS-arm64 but attempting to link with file built for macOS-x86_64 Undefined symbols 
for architecture arm64: "_MD5_Final", referenced from: _main in md5-46c6b0.o "_MD5_Init", referenced 
from: _main in md5-46c6b0.o "_MD5_Update", referenced from: _main in md5-46c6b0.o 
ld: symbol(s) not found for architecture arm64

 

 

해결

위에서 openssl 설치할 때 만든 ~/openssl-1.1.1g-arm64 폴더로 이동해서 아래 명령어 순서대로 입력

./Configure CC=clang CXX=clang++ CFLAGS="-arch arm64" CXXFLAGS="-arch arm64" LDFLAGS="-L/usr/local/opt/openssl/lib" CPPFLAGS="-I/usr/local/opt/openssl/include"
make
make install

 

3. sha1 관련 컴파일 에러

 

c프로그램 컴파일 시 에러문

Undefined symbols for architecture arm64:
  "_SHA1_Final", referenced from:
      _do_fp in sha1-0d35b4.o
  "_SHA1_Init", referenced from:
      _do_fp in sha1-0d35b4.o
  "_SHA1_Update", referenced from:
      _do_fp in sha1-0d35b4.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

해결

컴파일 할 때 -lcrypto 옵션 붙여줘야 함ㅋㅅㅋ

 

행복해..사실 안 행복해... 이걸 대체 몇 시간을

 

 

 

Ubuntu 22.04를 설치했는데 한글 입력이 되지 않았다.

설정에서 언어를 한글로 바꾸는 등 별 뻘짓을 다 했는데 키보드 설정을 손 댔어야 했다.

 

설정 방법은 다음과 같다.

 

1. ibus-hangul 패키지 설치

한글 패키지가 설치 되어있지 않다면 터미널에 아래 명령어를 입력해 설치해준다.

$ sudo apt-get install ibus ibus-hangul

 

2. 아래 명령어를 입력해 IBus 기본 설정 창으로 이동해 입력기 탭에서 Korean-Hangul을 추가한다.

$ ibus-setup

 

3. [설정] - [키보드] 창으로 이동해 Korean (Hangul)을 추가한다.

 

4. 추가 후 [기본 설정]을 클릭하면 한영 전환 키를 확인하고 변경할 수 있다.

+ Recent posts