상상 너머 그 무언가...

내컴퓨터에 설치한 MySQL 에 접속 본문

개발관련(Development)/데이터베이스(DB)

내컴퓨터에 설치한 MySQL 에 접속

Clack 2026. 8. 9. 18:16

MySQL 설치된 버전 확인

Macmini ~ % mysql --version
zsh: command not found: mysql
Macmini ~ % ls -l /usr/local/mysql/bin/mysql
-rwxr-xr-x  1 root  wheel  8033968  6월 30 23:48 /usr/local/mysql/bin/mysql

Macmini ~ % echo 'export PATH="/usr/local/mysql/bin:$PATH"' >> ~/.zshrc
Macmini ~ % source ~/.zshrc

Macmini ~ % mysql --version
mysql  Ver 8.4.11 for macos15 on arm64 (MySQL Community Server - GPL)
  • path 설정이 안되어 있어서 zshrc 파일에 추가하고 적용 후
  • 다시 버전 확인하여 정상적으로 나오는것 확인

MySQL에 root 계정으로 접속

Macmini ~ % mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.4.11 MySQL Community Server - GPL

Copyright (c) 2000, 2026, Oracle and/or its affiliates.

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>

 

현재 DATABASE 확인

mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.01 sec)

mysql>

DB 생성

mysql> CREATE DATABASE mygame;
Query OK, 1 row affected (0.00 sec)

mysql>

추가된 DB 확인

mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mygame             |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.00 sec)

mysql>