MySQL 설정 파일인 my.cnf 의 위치 확인은 다음과 같은 명령어로 확인이 가능하다.

# mysqld --verbose --help | grep -A 1 'Default options'

또는

 # mysqladmin -help

명령어를 실행하면 my.cnf 경로가 표시된다.

...
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf
...


 서비스 중지

shell> systemctl stop mysqld

 Data File 복사

shell> cp -r /var/lib/mysql /data/

 해당 디렉토리 권한 설정

shell> chwon -R mysql:mysql /data/mysql

 my.cnf 변경

shell> vi /etc/my.cnf
[mysqld]
#datadir=/var/lib/mysql
datadir=/data/mysql

 selinux 변경

기동 시 [ERROR] InnoDB: os_file_get_status() failed on './ibdata1'. Can't determine file permissions 오류가 난다면 실행

shell> setenforce 0

 서비스 재기동

shell> systemctl start mysqld


'DataBase > MySQL' 카테고리의 다른 글

[MySQL] 조회 시 콘솔에서 일본어 깨짐 현상  (0) 2017.11.22
[MySQL] my.cnf 위치 확인  (0) 2017.11.21
[MySQL] Schema 및 Table 용량 확인  (0) 2017.11.15
[MySQL]my.cnf  (0) 2017.11.14
[MySQL] Character Set, Collation 확인  (0) 2017.11.13

다음은 schema 별 용량을 확인하는 쿼리이다.

SELECT table_schema, ROUND( SUM(( data_length + index_length ) / 1024 / 1024 ), 2 ) AS 'Size(mb)'
FROM information_schema.tables
GROUP BY table_schema;

 

다음은 table 별 용량을 확인하는 쿼리이다.

SELECT table_name, ROUND((( data_length + index_length ) / 1024 / 1024 ), 2 ) AS 'Size(mb)'
FROM information_schema.tables
WHERE table_name = 'name';


'DataBase > MySQL' 카테고리의 다른 글

[MySQL] my.cnf 위치 확인  (0) 2017.11.21
[MySQL] data 파일 경로(datadir) 변경  (0) 2017.11.15
[MySQL]my.cnf  (0) 2017.11.14
[MySQL] Character Set, Collation 확인  (0) 2017.11.13
[MySQL] MySQL에서 shell command 사용하기  (0) 2017.11.09

+ Recent posts