1. mysql 실행


[root@localhost ~]# mysql -uroot -p

Enter password: "비밀번호 입력한다"


2. 


show variables like 'c%'; 


명령어 입력해서 character set을 확인합니다.


3.


quit


명령어를 입력해서 mysql실행을 종료합니다.


4. 


vi /etc/my.cnf


명령어를 입력해서 vi편집기를 통해 열어줍니다.


[mysql]

default-character-set = utf8


[mysqld]

character-set-client-handshake=FALSE

init_connect="SET collation_connection = utf8_general_ci"

init_connect="SET NAMES utf8"

character-set-server = utf8

collation-server = utf8_general_ci


[client]

default-character-set = utf8


위의 내용을 추가합니다.

vi편집기 명령어를 모른다면 검색해서 익숙해지자...


5.


service mysql restart


mysql을 재실행합니다.


6. 


show variables like 'c%'; 


다시 확인해줍니다.


7. 


만약 아직 database가 latin1으로 나온다면 데이터베이스 삭제후 다시 만들어줘야한다...


drop database DB이름;

create database DB이름;


끝~~







다음과 같은 오류가 발생한다면 PHP시간대 설정이 안되어있는 경우이다.


https://zetawiki.com/wiki/PHP_%EC%8B%9C%EA%B0%84%EB%8C%80_%EC%84%A4%EC%A0%95


* 확인


cat /etc/php.ini | grep timezone


* 수정


- sed로 수정

grep date.timezone /etc/php.ini

cp /etc/php.ini /etc/php.ini.old

sed -i 's/;date.timezone =/date.timezone = Asia\/Seoul/g' /etc/php.ini

diff /etc/php.ini.old /etc/php.ini


- 직접수정

vi /etc/php.ini

date.timezone = Asia/Seoul

위에처럼 주석을 제거하고 값을 넣어준다.


* 확인

php -r "echo date('Y-m-d H:i:s').PHP_EOL;"

service httpd restart

다음과 같은 오류가 발생한다면???


selinux 설정을 해제 해주어야합니다.


1. 일시적인 방법


setenforce 0


2. /etc/selinux/config 파일수정


vi편집기를 이용해서 


# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

빨간색으로 표시된 부분을


SELINUX=disabled

으로 수정합니다.


+ Recent posts