DB생성 실습한것.
root@realg-desktop:~#
root@realg-desktop:~#
root@realg-desktop:~# mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
root@realg-desktop:~# mysql -u root -p rmsidrhrhtldgksmsrjek
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
root@realg-desktop:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.0.67-0ubuntu6 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
mysql>
mysql>
mysql>
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
+--------------------+
2 rows in set (0.00 sec)
mysql> create database rgdjangoDEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| realgdjango |
+--------------------+
3 rows in set (0.00 sec)
mysql>
mysql> GRANT USAGE ON *.* TO realg@localhost IDENTIFIED BY "PASSWORD";
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> use realgdjango
Database changed
mysql>
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON realgdjango TO realg@localhost;
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> GRANT all ON realgdjango TO realg@localhost;
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql>
잘 안되서
GRANT ALL PRIVILEGES ON rgdjango.* to realg@localhost IDENTIFIED BY '757575' WITH GRANT OPTION;
GRANT ALL PRIVILEGES on *.* to realg@localhost IDENTIFIED BY '757575' WITH GRANT OPTION;
GRANT select, insert, delete, update on *.* to realg@localhost IDENTIFIED BY '757575' WITH GRANT OPTION;
이렇게 했더니 되었다.
utf-8로 설정하기!!!!!!!!!!
공부하자(smileemaker) 카페매니저 http://cafe.naver.com/painmaster/1158
1. etc/my.cnf (또는 my.ini) 에서 캐릭터셋 수정
[client]
#password = your_password
default-character-set=utf8
[mysqld]
init_connect=SET collation_connection = utf8_general_ci
init_connect=SET NAMES utf8
default-character-set=utf8
character-set-server=utf8
collation-server=utf8_general_ci
[mysql]
default-character-set=utf8
2. 환경변수를 모두 수정후 mysql 서비스 재시작
3. mysql에서 캐릭터셋 확인
# mysql
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use test
Database changed
mysql> show variables like 'c%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
| concurrent_insert | ON |
| connect_timeout | 5 |
+--------------------------+----------------------------+
12 rows in set (0.00 sec)
* MySql에서 데이터베이스 생성
mysql>CREATE DATABASE PAINBLOG DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
'DB > My SQL' 카테고리의 다른 글
Mysql DB 생성 및 사용자 추가 (0) | 2012.08.02 |
---|---|
초간단 mySQL db 생성 요약. (0) | 2009.01.01 |
MySQL DB 데이타 백업복구 하는 방법 (0) | 2008.03.18 |