Develop record
[Maria DB] Access denied for user 'shop'@'localhost' (using password: YES) 본문
오류
[Maria DB] Access denied for user 'shop'@'localhost' (using password: YES)
seong's log 2024. 6. 27. 00:51환경
- Dbeaver
- mariadb
- mac m3
- iMac
문제 상황
Access denied for user 'shop'@'localhost' (using password: YES)
- PASER ngram 적용 없이 fulltext index 생성 후 PASER ngram를 적용하기 위해 mariaDB 업그레이드
- 기존의 fulltext index 삭제 하려고 하니까 위의 에러 발생
- 터미널에 mysql 접근 하려니까 새로운 에러 발생
$ mysql -uroot -p
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
실패
(1) 서비스 상태 확인
$ brew services list
Name Status User File
mariadb@10.11 started hyeseong ~/Library/LaunchAgents/homebrew.mxcl.mariadb@10.11.plist
mysql started hyeseong ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
tomcat none
(2) mysql 경로 확인
$ brew --prefix mysql
/opt/homebrew/opt/mysql
// 경로 이동
$ cd /opt/homebrew/opt/mysql/support-files
// 서버 파일 직접 시작
$ ./mysql.server start
Starting MySQL
. ERROR! The server quit without updating PID file (/opt/homebrew/var/mysql/eomhyeseong-ui-iMac.local.pid).
- /opt/homebrew/var/mysql/eomhyeseong-ui-iMac.local.pid 파일을 업데이트하지 못해 서버가 정상적으로 시작되지 않아 오류가 발생했다
1. 소유자 확인
$ ls -ld /opt/homebrew/var/mysql
drwxr-xr-x 19 hyeseong admin 608 6 27 00:44 /opt/homebrew/var/mysql
2. 소유자를 mysqlf로 변경
$ sudo chown -R mysql:mysql /opt/homebrew/var/mysql
3. 권환 변경
$ sudo chmod -R 777 /opt/homebrew/var/mysql
4. 서버 재시작
// 서버 재시작
$ brew services restart mysql
// .pid 파일 확인
$ ls -l /opt/homebrew/var/mysql/eomhyeseong-ui-iMac.local.pid
ls: /opt/homebrew/var/mysql/eomhyeseong-ui-iMac.local.pid: No such file or directory
// 로그 파일 확인
$ ls -l /opt/homebrew/var/mysql/eomhyeseong-ui-iMac.local.err
// 에러 무한 반복
2024-06-27 0:57:48 1461 [Warning] Access denied for user 'shop'@'localhost' (using password: YES)
2024-06-26T15:57:49.310194Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
2024-06-26T15:57:50.378533Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
2024-06-26T15:57:51.450612Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 35
5. .pid 수동으로 생성하기
$ sudo chown mysql:mysql /opt/homebrew/var/mysql/eomhyeseong-ui-iMac.pid
$ sudo chown mysql:mysql /opt/homebrew/var/mysql/eomhyeseong-ui-iMac.pid
// .pid 파일 생성 되어 있음
$ ls -l /opt/homebrew/var/mysql/
total 248656
-rwxrwxrwx 1 _mysql _mysql 417792 6 26 22:55 aria_log.00000001
-rwxrwxrwx 1 _mysql _mysql 52 6 26 22:55 aria_log_control
-rw-r----- 1 hyeseong _mysql 56 6 27 00:47 auto.cnf
-rwxrwxrwx 1 _mysql _mysql 0 6 26 23:08 binlog.index
-rwxrwxrwx 1 _mysql _mysql 9 6 26 22:56 ddl_recovery.log
-rwxrwxrwx 1 _mysql _mysql 968452 6 27 01:03 eomhyeseong-ui-iMac.local.err
-rw-r--r-- 1 _mysql _mysql 0 6 27 01:02 eomhyeseong-ui-iMac.pid
-rwxrwxrwx 1 _mysql _mysql 906 6 26 22:55 ib_buffer_pool
-rwxrwxrwx 1 _mysql _mysql 100663296 6 26 22:55 ib_logfile0
-rwxrwxrwx 1 _mysql _mysql 12582912 6 26 22:55 ibdata1
-rwxrwxrwx 1 _mysql _mysql 12582912 6 26 22:56 ibtmp1
-rwxrwxrwx 1 _mysql _mysql 0 6 26 22:56 multi-master.info
drwxrwxrwx 90 _mysql _mysql 2880 6 26 22:54 mysql
-rwxrwxrwx 1 _mysql _mysql 15 6 26 22:55 mysql_upgrade_info
drwxrwxrwx 3 _mysql _mysql 96 6 26 22:54 performance_schema
drwxrwxrwx 106 _mysql _mysql 3392 6 26 22:54 sys
drwxrwxrwx 3 _mysql _mysql 96 6 26 22:54 test
// 재실행
$ ./mysql.server start
Starting MySQL
. ERROR! The server quit without updating PID file (/opt/homebrew/var/mysql/eomhyeseong-ui-iMac.local.pid).
해결
결국 그냥 삭제하기로 했다...
MySQL 제거하기
// mysql 서버 중지
$ brew services stop mysql
// Homebrew를 통해 mysql 패키지 제거
$ brew uninstall mysql
// mysql 데이터 디렉토리 삭제
// => 모든 데이터가 삭제되기 때문에 초기화해도 무방한 경우에만 진행하거나 백업해두기!!
$ sudo rm -rf /opt/homebrew/var/mysql
// mysql 설정 파일 삭제
$ sudo rm /opt/homebrew/etc/my.cnf
MySQL 설치
$ brew install mysql
// 보안설정
$ mysql_secure_installation
비밀번호 설정한 뒤 모두 Y 설정하니까 접속된다!!! 드디어~~
'오류' 카테고리의 다른 글
[github] push 할 때 token 로그인 안됨 (0) | 2024.06.27 |
---|