ROOT로그인하기
[daforu@os daforu]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 66 to server version: 4.0.18-standard
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
데이터베이스만들기
mysql> create database blog_deokae;
Query OK, 1 row affected (0.00 sec)
계정생성SQL문
mysql> GRANT USAGE ON *.* TO 아이디@localhost IDENTIFIED BY "비밀번호";
Query OK, 0 rows affected (0.00 sec)
생성한데이터베이스에 사용권한 부여하기
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON blog_deokae TO daforu@localhost;
ERROR 1046: No Database Selected <-데이터베이스를 선택하지 않고하면 에러!
mysql> use blog_deokae;
Database changed
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON blog_deokae TO daforu@localhost;
Query OK, 0 rows affected (0.01 sec)
***
mysql> GRANT all ON blog_deokae TO daforu@localhost; <- 선택디비관련모든권한주기
Query OK, 0 rows affected (0.00 sec)
권한을 다시 로드하기
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
.. 다시 로그인
[daforu@os bin]$ pwd
/usr/local/mysql/bin
[daforu@os bin]$ mysql -u daforu -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 90 to server version: 4.0.18-standard
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
현재 계정에 있는 테이블은 2개!
mysql> show databases;
+-------------+
| Database |
+-------------+
| blog_deokae |
| test |
+-------------+
2 rows in set (0.00 sec)
'mysql' 카테고리의 다른 글
백업과 복구 (0) | 2013.02.28 |
---|---|
MySql 4.x 버젼과 MySql 5.x 버젼 password 함수 차이 (0) | 2013.02.28 |
버전별 MySQL user , db , database 생성 삭제 (0) | 2013.02.18 |
MySQL UTF-8 언어 설정 방법 (0) | 2013.02.18 |
mysql 백업 스크립트 2 (0) | 2013.02.18 |