MySQL Install
Mac OS 기준이며, brew를 이용해 설치할 수 있다.
터미널을 열어 brew update
입력 후, brew install mysql
을 입력해 설치한다.
$ brew update
$ brew install mysql
설치가 완료되면, 서버를 실행하기 위해 터미널에 brew services start mysql
을 입력한다.
$ brew services start mysql1
이 상태로도 사용할 수 있지만, 보안을 위해 비밀번호를 설정해주도록 한다.
터미널에 mysql\_secure\_installation
라고 입력한다.
$ mysql_secure_installation
복잡한 비밀번호를 사용할것이냐는 질문에 N 을 입력하고 엔터를 입력한다.
New password:
Re-enter new password:
New password
: 라고 나오면, 비밀번호를 입력하고 엔터를 쳐서 설정하고,
Re-enter new password
: 비밀번호를 다시 입력한다.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
y를 입력해, 익명의 유저를 삭제하는데 동의하고,
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n
n을 입력해 root의 원격 접속을 허용한다.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : n
... skipping.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
n을 입력해 test 데이터베이스를 유지한다.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.
y를 입력해 변경된 권한을 테이블에 적용한다.
All done!
MySQL 접속 확인
터미널에 mysql -u -root -p
라고 입력한 뒤, 방금 설정한 비밀번호를 입력하여 mysql에 접속한다.
mysql>
처럼 터미널이 바뀌면 접속에 성공한것이다!
'데이터베이스 > MySQL' 카테고리의 다른 글
[MySQL] 기본 CRUD 및 쿼리 정리 (0) | 2024.04.19 |
---|---|
[MySQL] DBMS와 MySQL의 개념 (0) | 2024.04.15 |