레이블이 mysql인 게시물을 표시합니다. 모든 게시물 표시
레이블이 mysql인 게시물을 표시합니다. 모든 게시물 표시

2013-12-03

mysql remote connection 설정

my.cnf 파일에서 bind-address를 0.0.0.0로 바꾸자. 특정 ip로 설정할 수도 있지만 localhost도 listen해야 하므로 두개 이상 설정해야 하고, 두개를 등록하는 방법은 없다. 0.0.0.0으로 하고 firewall을 세팅해야 한다.

bind-address        = 0.0.0.0
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypass';
CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass';

GRANT ALL ON *.* TO 'myuser'@'localhost';
GRANT ALL ON *.* TO 'myuser'@'%';

2011-12-07

mysql utf-8 세팅

이런걸 위해 굳이 레퍼런스까지 찾아보기는 귀찮고, 나중에 참고하며 반복하기 좋으라고 기록해 둔다.

/etc/mysql/my.cnf 파일을 열고 아래 내용을 추가한다.

[client]

default-character-set=utf8

[mysqld]

default-character-set=utf8
default-collation=utf8_general_ci
init_connect=set collation_connection=utf8_general_ci
init_connect=set names utf8
character-set-server=utf8
collation-server=utf8_general_ci
character-set-client-handshake = TRUE

[mysql]

default-character-set=utf8

mac osx 에서는 위에 있는 것을 다 할 필요 없이 몇가지만 입력하면 되더라. mac에서는

/usr/local/mysql/support-files$ sudo cp my-medium.cnf /etc/my.cnf
한 다음 my.cnf 를 수정한다.

[client]

default-character-set=utf8

[mysqld]

character-set-server=utf8
collation-server=utf8_general_ci

[mysql]

default-character-set=utf8

아래와 같이 나오면 된듯 하다.

mysql> show variables like 'c%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| 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            |
| completion_type          | 0                          |
| concurrent_insert        | 1                          |
| connect_timeout          | 10                         |
+--------------------------+----------------------------+
14 rows in set (0.00 sec)

2011-01-12

mysql access denied

mysql user를 만들고 패스워드도 주었는데 자꾸 패스워드 없이 로그인되길래...

http://dev.mysql.com/doc/refman/5.5/en/access-denied.html

If you cannot figure out why you get Access denied, remove from the user table all entries that have Host values containing wildcards (entries that contain '%' or '_' characters). A very common error is to insert a new entry with Host='%' and User='some_user', thinking that this enables you to specify localhost to connect from the same machine. The reason that this does not work is that the default privileges include an entry with Host='localhost' and User=''. Because that entry has a Host value 'localhost' that is more specific than '%', it is used in preference to the new entry when connecting from localhost! The correct procedure is to insert a second entry with Host='localhost' and User='some_user', or to delete the entry with Host='localhost' and User=''. After deleting the entry, remember to issue a FLUSH PRIVILEGES statement to reload the grant tables. See also Section 5.4.4, “Access Control, Stage 1: Connection Verification”.

2010-10-19

mysql user 생성

참고 삼아...
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;

2010-09-02

Convert latin1 to UTF-8 in MySQL - Gentoo Linux Wiki

Convert latin1 to UTF-8 in MySQL - Gentoo Linux Wiki

Mediawiki 업그레이드 하다가 기존 db가 latin1이었고, 새 mysql은 utf8이라 무지 삽질했는데, 결국은 다음과 같은 문장때문이었다. 각 테이블을 utf8로 바꾼다 하더라도 다음 문장 때문에 실패하였다.

ar_title varchar(255) character set latin1 collate latin1_bin NOT NULL default
vi 에디터로 위 문장을 utf8로 바꾸어 주어야 한다. 아래와 같이...
:%s/character set latin1 collate latin1_bin/
/character set utf8 collate utf8_general_ci/g
(길어서 2줄로 썼다. 한줄로 입력 바람)