티스토리 뷰
1.MySQL 실행하기
MySQL 경로는 /usr/local/Cellar/mysql/5.6.25/
MySQL을 실행해보자
/usr/local/Cellar/mysql/5.6.25/support-files
EminentStarui-MacBook-Pro:support-files eminentstar$ mysql.server start
Starting MySQL
. SUCCESS!
2.MySQL 접속하기
보통은 커맨드라인 어디서든 mysql로 로그인하면 된다. 하지만 그냥 로그인하면 권한이 없는 경우가 많다. 그래서 일단 root로 로그인하자. 맥에 처음 mysql을 깔았다면 root는 비밀번호 없이도 로컬에서 접속이 가능할 것이다.
EminentStarui-MacBook-Pro:support-files eminentstar$ mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.25 Homebrew
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
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>
mysql> create database testdb;
Query OK, 1 row affected (0.00 sec)
mysql> show create database testdb;
+----------+-----------------------------------------------------------------+
| Database | Create Database |
+----------+-----------------------------------------------------------------+
| testdb | CREATE DATABASE `testdb` /*!40100 DEFAULT CHARACTER SET utf8 */ |
+----------+-----------------------------------------------------------------+
1 row in set (0.00 sec)
- /etc/my.cnf
- /etc/mysql/my.cnf
- /usr/local/mysql/etc/my.cnf
- ~/.my.cnf
EminentStarui-MacBook-Pro:support-files eminentstar$ sudo cp /usr/local/Cellar/mysql/5.6.25/support-files/my-default.cnf /etc/my.cnf
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
init_connect=SET collation_connection=utf8_general_ci
init_connect=SET NAMES utf8
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
EminentStarui-MacBook-Pro:etc eminentstar$ /usr/local/Cellar/mysql/5.6.25/support-files/mysql.server restart
mysql> create database testdb;
Query OK, 1 row affected (0.00 sec)
mysql> show create database testdb;
+----------+-----------------------------------------------------------------+
| Database | Create Database |
+----------+-----------------------------------------------------------------+
| testdb | CREATE DATABASE `testdb` /*!40100 DEFAULT CHARACTER SET utf8 */ |
+----------+-----------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> grant all privileges on testdb.* to dev@localhost identified by '0000';
Query OK, 0 rows affected (0.00 sec)
EminentStarui-MacBook-Pro:etc eminentstar$ mysql -u dev -p
Warning: World-writable config file '/etc/my.cnf' is ignored
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
| testdb |
+--------------------+
3 rows in set (0.00 sec)
mysql>
'Database > Mysql' 카테고리의 다른 글
MySQL 테이블 생성하기 (0) | 2015.07.14 |
---|---|
MySQL 설치하기(2015.07.11) (0) | 2015.07.11 |
- Total
- Today
- Yesterday
- JVM
- NGINX
- log level
- java
- webserver
- linux
- logging facade
- logging
- log
- runtime data areas
- lood
- slf4j
- TaskExecutor
- good practice
- Spring
- Apache
- async
- object
- logback
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |