파일 권한이 잘못되어 MySQL 서버를 시작할 수 없습니까?


16

서버를 시작한 다음 루트 사용자를 수정하려고합니다.

$ mysql -u root mysql
$mysql> UPDATE user SET Password=PASSWORD('my_password') where USER='root';
$mysql> FLUSH PRIVILEGES;

그러나 서버를 시작할 수 없습니다 :

$ mysqld --skip-grant-tables
2014-10-21 07:18:24 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-10-21 07:18:24 1967 [Warning] Can't create test file /usr/local/mysql-5.6.21-osx10.8-x86_64/data/x4430.lower-test
2014-10-21 07:18:24 1967 [Warning] Can't create test file /usr/local/mysql-5.6.21-osx10.8-x86_64/data/x4430.lower-test
2014-10-21 07:18:24 1967 [Note] Plugin 'FEDERATED' is disabled.
2014-10-21 07:18:24 1967 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-10-21 07:18:24 1967 [Note] InnoDB: The InnoDB memory heap is disabled
2014-10-21 07:18:24 1967 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-10-21 07:18:24 1967 [Note] InnoDB: Memory barrier is not used
2014-10-21 07:18:24 1967 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-10-21 07:18:24 1967 [Note] InnoDB: Using CPU crc32 instructions
2014-10-21 07:18:24 1967 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-10-21 07:18:24 1967 [Note] InnoDB: Completed initialization of buffer pool
2014-10-21 07:18:24 1967 [ERROR] InnoDB: ./ibdata1 can't be opened in read-write mode
2014-10-21 07:18:24 1967 [ERROR] InnoDB: The system tablespace must be writable!
2014-10-21 07:18:24 1967 [ERROR] Plugin 'InnoDB' init function returned error.
2014-10-21 07:18:24 1967 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2014-10-21 07:18:24 1967 [ERROR] Unknown/unsupported storage engine: InnoDB
2014-10-21 07:18:24 1967 [ERROR] Aborting

2014-10-21 07:18:24 1967 [Note] Binlog end
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'partition'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_METRICS'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_CMPMEM'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_CMP'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_LOCKS'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'INNODB_TRX'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'BLACKHOLE'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'ARCHIVE'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'MRG_MYISAM'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'MyISAM'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'MEMORY'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'CSV'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'sha256_password'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'mysql_old_password'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'mysql_native_password'
2014-10-21 07:18:24 1967 [Note] Shutting down plugin 'binlog'
2014-10-21 07:18:24 1967 [Note] mysqld: Shutdown complete

Mac OS X 10.9.5 및 MySQL : EditLine 래퍼를 사용하는 osx10.8 (x86_64) 용 mysql Ver 14.14 Distrib 5.6.21

권한 :

$ ls -la /usr/local/mysql-5.6.21-osx10.8-x86_64
total 232
drwxr-xr-x  17 qazwsx  wheel    578 Oct 20 23:27 .
drwxrwxr-x  23 qazwsx  admin    782 Oct 20 23:27 ..
-rw-r--r--   1 qazwsx  wheel  17987 Sep 11 06:53 COPYING
-rw-r--r--   1 qazwsx  wheel  87980 Sep 11 06:53 INSTALL-BINARY
-rw-r--r--   1 qazwsx  wheel   2496 Sep 11 06:53 README
drwxr-xr-x  47 qazwsx  wheel   1598 Oct 20 23:27 bin
drwxr-xr-x  12 _mysql  wheel    408 Oct 21 07:13 data
drwxr-xr-x   5 qazwsx  wheel    170 Oct 20 23:27 docs
drwxr-xr-x  45 qazwsx  wheel   1530 Oct 20 23:27 include
drwxr-xr-x  12 qazwsx  wheel    408 Oct 20 23:27 lib
drwxr-xr-x   4 qazwsx  wheel    136 Sep 11 07:13 man
-rw-r--r--   1 qazwsx  wheel    943 Oct 20 23:25 my.cnf
drwxr-xr-x  19 qazwsx  wheel    646 Oct 20 23:27 mysql-test
drwxr-xr-x   3 qazwsx  wheel    102 Oct 20 23:27 scripts
drwxr-xr-x  36 qazwsx  wheel   1224 Oct 20 23:27 share
drwxr-xr-x  28 qazwsx  wheel    952 Oct 20 23:27 sql-bench
drwxr-xr-x   8 qazwsx  wheel    272 Oct 20 23:27 support-files


$ ls -la /usr/local/mysql-5.6.21-osx10.8-x86_64/data/
total 221248
drwxr-xr-x  12 _mysql  wheel       408 Oct 21 07:13 .
drwxr-xr-x  17 qazwsx  wheel       578 Oct 20 23:27 ..
-rw-rw----   1 _mysql  wheel        56 Oct 20 23:28 auto.cnf
drwx------   3 _mysql  wheel       102 Oct 20 23:45 cloudplatform
-rw-rw----   1 _mysql  wheel  50331648 Oct 21 07:13 ib_logfile0
-rw-rw----   1 _mysql  wheel  50331648 Oct 20 23:25 ib_logfile1
-rw-rw----   1 _mysql  wheel  12582912 Oct 21 07:13 ibdata1
drwx------  81 _mysql  wheel      2754 Oct 20 23:25 mysql
drwx------  55 _mysql  wheel      1870 Oct 20 23:25 performance_schema
drwxr-xr-x   3 _mysql  wheel       102 Oct 20 23:27 test
-rw-r-----   1 _mysql  wheel     24444 Oct 21 07:13 x4430.err
-rw-rw----   1 _mysql  wheel         5 Oct 21 07:13 x4430.pid

답변:


16

전체 폴더는 mysql이 소유해야합니다

cd /usr/local/mysql-5.6.21-osx10.8-x86_64/data/
chown -R mysql:mysql *

그런 다음 mysql을 다시 시작하십시오.

시도 해봐 !!!


osx10.12 (x86_64) 용 Mac OS Sierra 및 mysql Ver 14.14 Distrib 5.7.16에서 homebrew를 사용하여 "cd / usr / local / var; chown -R mysql : mysql mysql"
Tad

3

같은 오류에 대한 또 다른 이유가 있습니다. homebrew를 사용하여 mysql을 설치합니다.

다음 명령을 사용하여 서버를 중지 할 수 없습니다.

mysql.server stop

mysql 프로세스가 자동으로 다시 시작됩니다. 이를 막을 수있는 유일한 방법은이 명령을 사용하는 것입니다.

brew services stop mysql

그런 다음 루트 사용자의 문제를 해결할 수 있습니다.


2

apparmor와 같은 것들이 mysql의 디렉토리에 대한 쓰기 액세스를 차단할 수 있다는 것을 잊지 마십시오.

/etc/apparmor.d/usr.sbin.mysqld와 같은 장소를보고 mysql 데이터 디렉토리에 "** rwk"를 지정하십시오. (apparmor 재시작 필요) apparmor 보고서에 대해서는 /var/log/kern.log와 같은 위치를 참조하십시오.

당사 사이트를 사용함과 동시에 당사의 쿠키 정책개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.