database.sarang.net
UserID
Passwd
Database
DBMS
ㆍMySQL
PostgreSQL
Firebird
Oracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
MySQL Q&A 31258 게시물 읽기
No. 31258
CentOS7 MySQL 8.0.15 질문입니다.
작성자
김말포
작성일
2019-08-27 01:11
조회수
3,596

 데이터 테이블명 조회 시 대소문자 구분 없이 조회하기 위해

lower_case_table_names=1 이라는 속성을 주어야 한다는 것을 알고있습니다.

그러나,

https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_tab

이곳의 문서를 참조하면, 

It is prohibited to start the server with a lower_case_table_names setting that is different from the setting used when the server was initialized.

The restriction is necessary because collations used by various data dictionary table fields are determined by the setting defined when the server is initialized,

and restarting the server with a different setting would introduce inconsistencies with respect to how identifiers are ordered and compared.

라는 말이 있습니다.

 

즉 기존 사용하던 mysql에서 my.cnf 파일의 [mysqld] 부분에 lower_case_table_names=1 이라는 속성을 주어서 바꿀수가 없는 것 같습니다.

(실제로 my.cnf 파일을 수정하여 mysql을 restart 하면 에러가 남. )

 

에러는

https://bugs.mysql.com/bug.php?id=90695

의 현상과 같습니다. 

제 에러 메세지는

 

Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.

라고 나와서, status를 참고하면, 

 

   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)

   Active: failed (Result: exit-code) since 화 2019-08-27 00:50:04 KST; 13min ago

     Docs: man:mysqld(8)

           http://dev.mysql.com/doc/refman/en/using-systemd.html

  Process: 6562 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS (code=exited, status=1/FAILURE)

  Process: 6543 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)

 Main PID: 6562 (code=exited, status=1/FAILURE)

   Status: "SERVER_BOOTING"

    Error: 2 (그런 파일이나 디렉터리가 없습니다)

 

 8월 27 00:50:03 localhost.localdomain systemd[1]: Starting MySQL Server...

 8월 27 00:50:04 localhost.localdomain systemd[1]: mysqld.service: main process exited, code=exited, status=1/FAILURE

 8월 27 00:50:04 localhost.localdomain systemd[1]: Failed to start MySQL Server.

 8월 27 00:50:04 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state.

 8월 27 00:50:04 localhost.localdomain systemd[1]: mysqld.service failed.

 

또한 mysqld.log파일을 보면

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2019-08-26T13:37:25.035605Z 1 [ERROR] [MY-011087] [Server] Different lower_case_table_names settings for server ('1') and data dictionary ('0').

 

2019-08-26T13:37:25.036189Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.

2019-08-26T13:37:25.036786Z 0 [ERROR] [MY-010119] [Server] Aborting

라고 적혀있습니다.

 

 

해결책을 찾던 중, 제가 시도한 방법은 다음과 같습니다.

1. mysql과 관련된 모든 항목을 삭제한 후, rpm으로 설치만 한 뒤 바로 my.cnf 에 lower_case_table_names=1 추가 후 start => 기존의 에러와 같은 에러

2.  stackoverflow의

https://stackoverflow.com/questions/53103588/lower-case-table-names-1-on-ubuntu-18-04-doesnt-let-mysql-to-start/53175727#53175727

글을 참조하여 다음의 절차를 진행  => 처음과 같은 에러

 

In order to make this work in MySQL 8.0 and linux follow the steps bellow

0) Backup mysql schema before executing the following steps using

mysqldump  -h localhost -u root -p mysql > /home/username/dumps/mysqldump.sql

and then stop mysql using

sudo service mysql stop

1) move or remove /var/lib/mysql directory. This will delete all databases!!!!

mv /var/lib/mysql /tmp/mysql

2)Create a new /var/lib/mysql directory and make mysql user as owner

mkdir /var/lib/mysql chown -R mysql:mysql /var/lib/mysql chmod 750 /var/lib/mysql

3)edit /etc/mysql/mysql.conf.d/mysqld.cnf and add the following line after [mysqld]

lower_case_table_names=1

4) Initialize mysql using the following

mysqld --defaults-file=/etc/mysql/my.cnf --initialize lower_case_table_names=1 --user=mysql --console

Change defaults-file with the actual location of your defaults file. more info on mysql initialization here: https://dev.mysql.com/doc/refman/8.0/en/data-directory-initialization-mysqld.html

5) (Optional) Repeat

chown -R mysql:mysql /var/lib/mysql chmod 750 /var/lib/mysql

if owner of the files in /var/lib/mysql is not mysql

6)Start mysql using

sudo service mysql start

7) If everything worked correctly, open mysql using

mysql -u root -p

and by running this query

SHOW VARIABLES where Variable_name like 'lower%';

you will get

'lower_case_table_names', '1'

8)Restore mysql schema using the dump created in step 0.

 

 

그외의 많은 방법을 해봤지만, 어떤 경우에도 서비스를 start 할 때 똑같은 에러가 계속 납니다.

 

 

이 문제로 지금 7일째 MySQL을 사용하지 못하고 있는데요

혼자 공부를 하다보니 도움받을 곳이 마땅치 않아 질문을 올려봅니다 .. 정말 해결하고싶습니다 ..

[Top]
No.
제목
작성자
작성일
조회
31261MySQL서버 DB이전 관련 질문입니다. [1]
허영호
2019-09-24
2288
31260mariadb 트랜잭션 질문드립니다.
트랜잭션
2019-09-09
2279
31259게시판에서 데이터 속도개선방법 질문입니다.
원재호
2019-08-28
2065
31258CentOS7 MySQL 8.0.15 질문입니다.
김말포
2019-08-27
3596
31257쿼리 처리 순서 질문입니다. [1]
원재호
2019-08-16
2130
31256트리거 쿼리 하루종일 오류 나는데 1064 오류 확인좀 부탁드립니다 ㅠ [1]
hi
2019-08-13
2050
31255특정 테이블에 쿼리문 사용시 데이터베이스명을 명시해줘야 하는 현상 [2]
mattqnrp
2019-08-12
2164
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2023 DSN, All rights reserved.
작업시간: 0.049초, 이곳 서비스는
	PostgreSQL v16.1로 자료를 관리합니다