Mac - MySQL 설치 및 접속 및 유저 생성 및 권한주기
homebrew 설치
- 아래 링크에서 homebrew만 따라하기
Homebrew 및 nvm 설치, node 설치까지
homebrew mac 용 패키지 설치 관리 애플리케이션 homebrew 홈페이지 들어가서 설치하기 Homebrew The Missing Package Manager for macOS (or Linux). brew.sh nvm - node version manager 여러 버전의 node 설치 및 버전 변경 관리
pongo.tistory.com
설치!
- 아래 링크 중 골라서 설치하기
M1 맥북 초간단 mySQL 설치법 / mysql Homebrew설치 (상세)
맥린이 시절 mysql 다운법을 포스팅 했었는데요, 그 방법은 더 어렵고 복잡하며, 설치가 잘 안되는 경우가 있더라구요 ㅠㅠ 그래서 초간단 mySQL 설치법을 다시 포스팅 하려 합니다. 포스팅 목차 1.
eunhee-programming.tistory.com
(MAC) MySQL 설치하기
homebrew 설치 → https://brew.sh/index_kohomebrew를 이용해 mysql을 설치하는 게 가장 간단하고 관리하기 편함터미널을 켜고 아래의 명령어를 입력설치 완료 후 mysql의 버전 확인mysql Ver 8.0.27 for maco
velog.io
설치 중 에러
Error - bash: mysql: command not found
[MySQL] Error - bash: mysql: command not found
"Error - bash: mysql: command not found" 위 오류는 mysql 명령어를 찾을 수 없을 때 발생하는 오류이다. 위 오류가 발생하는 이유는 명령어의 경로를 환경변수로 지정해주지 않아서 발생한다. ■ 해결방법
ryean.tistory.com
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[MySQL] Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 에러 해결 사례
m1 mac 관련 포스팅은 많이 없더라고요
velog.io
Access denied for user '유저아이디'@'localhost' (using password: YES)
[MySQL] Access denied for user '유저아이디'@'localhost' (using password: YES) 에러 해결방법
와 정말 말도 안 되는 삽질 끝에.. 에러를 해결했다..!! 문제 상황 [OS는 Windows10, MySQL은 8.0.29] 처음으로 MySQL을 설치하고, 이클립스에서 데이터베이스 연결을 하려는데 Access denied for user '유저아이
oneul-losnue.tistory.com
실행 및 유저 등록, 권한 주기
// cd /usr/local/mysql/bin
mysql -u root -p
use mysql;
# user 보기
select host, user from user;
# testuser에서 db 사용하기
mysql -utestuser -ptest1234
외부접근권한만 있는 계정에게 grant를 해도 이클립스에서 내가 짠 코드는
localhost로 요청을 보내는 것이기 때문에, 같은 이름이라도
localhost접근 권한이 있는 'testuser'유저를 새로 만들고 권한을 줘야 해결 되는 문제였다.
# user 등록
create user 'testuser'@'%' identified by '비밀번호';
create user 'testuser'@'localhost' identified by '비밀번호';
# user 삭제
drop user 'testuser'@'localhost;
# root에서 testuser에 권한 주기
grant all privileges on *.* to 'testuser'@'%' with grant option;
grant all privileges on *.* to 'testuser'@'localhost' with grant option;
# 변경사항 적용
flush privileges;
# database 만들기
create database [데이터베이스 이름];
show databases;
# 지우기
drop database [데이터베이스 이름];
# 데이터베이스 사용
use [데이터베이스 이름];
# table 보기
show tables;
cd /usr/local/mysql/bin말고 바로 mysql하고 싶을 때
.zshrc에 환경변수 설정
open -e .zshrc
export PATH=$PATH:/usr/local/mysql/bin/
source .zshrc
mysql 서버 시작
mysql.server start
mysql.server stop
// 데몬으로 실행 (운영체제 백그라운드 상태에서 계속 실행)
brew services start mysql //실행
brew services stop mysql //중단
brew services restart mysql
brew services list //실행중인지 상태 확인
Error - bash: mysql: command not found
ㄴㅇㅇ