MYSQL 접속 : mysql -h [host] -u [user] -p[패스워드] [database 명 ]
root 계정으로 mysql 라는 데이터베이스로 접속할 경우
$mysql -u root -p mysql
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 303669
Server version: 5.0.45-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
inetdb DB 만드는 방법
mysql> create database inetdb;
Query OK, 1 row affected (0.00 sec)
생성된 데이터베이스 리스트들을 보여준다.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| inetdb |
| test |
+--------------------+
10 rows in set (0.00 sec)
mysql>
생성된 데이터베이스 inetdb 삭제 방법
Mysql > drop database inetdb;
* 예) host: localhost , DB명: inetdb , 사용자계정: inet , 패스워드:1234
Mysql> grant all privileges on inetdb.* to inet@’localhost’ identified by ‘1234’;
* 사용자 계정 추가 확인방법
Mysql >select * from user where user=’inet’;
mysql > select * from db where user=’inet’
- 해당 리스트들이 나오면 계정권한 설정한것들을 볼수가 있다.
* 필드 내용 수정 (inet계정을 inet1234로 수정)
Mysql > update user set user=’inet1234’ where user=’inet’;
root패스워드를 1234로 수정
Mysql > update user set password=password(‘1234’) where user=’root’;
* 추가한 아이디 삭제
Mysql > delete from user where user=’inet’;
Mysql > delete from db where user=’inet’;