치명적인 오류 : 권한 테이블을 열고 잠글 수 없음 : 테이블 'mysql.host'가 존재하지 않습니다.
RHEL 5에 새로 설치 한 서버에 있습니다. Apache와 PHP를 제대로 설치할 수 있었지만 MySQL 설치에 심각한 문제가 있습니다. 다음을 시도했습니다.
yum install mysql-server mysql
그리고 오류나 충돌이 발생하지 않았습니다. 그런 다음 다음 명령으로 mysql을 시작하려고했습니다.
chkconfig --levels 235 mysqld on
service mysqld start
그리고 얻다 Timeout error occurred trying to start MySQL Daemon.
내 로그를 확인한 결과 다음 오류가 표시됩니다.
[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
여기서 어디로 가야할지 모르겠습니다.
참고로 RHEL 5를 사용하고 있으며 최신 버전의 PHP 5 및 Apache를 설치했습니다.
다음을 사용하여 mysql 제거
yum remove mysql*
재귀 적으로 삭제
/usr/bin/mysql
하고/var/lib/mysql
파일 삭제
/etc/my.cnf.rmp
ps -e
프로세스를 확인하여 mysql이 아직 실행되고 있지 않은지 확인하는 데 사용 합니다.다음을 사용하여 서버 재부팅
reboot
을 실행
yum install mysql-server
합니다. 이것은 또한 mysql 클라이언트를 종속성으로 설치하는 것 같습니다.다음을 사용하여 mysql 소유권 및 그룹 권한을 부여하십시오.
chown -R mysql /var/lib/mysql
chgrp -R mysql /var/lib/mysql
service mysqld start
MySQL 데몬을 시작하는 데 사용 합니다.
후 chown
와 chgrp
보내고 ' /var/lib/mysql
로 대답 당 @Bad 프로그래머 , 당신은 또한 다음 명령을 실행 할 수 있습니다 :
sudo mysql_install_db --user=mysql --ldata=/var/lib/mysql
그런 다음 mysqld
.
아치 리눅스 에서도이 문제가 발생했습니다. 문제는 pacman이 MySQL이 예상했던 것과 다른 위치에 패키지를 설치했다는 것입니다. 이 문제를 해결할 수있었습니다.
sudo mysql_install_db --user=mysql --basedir=/usr/ --ldata=/var/lib/mysql/
이것이 누군가를 돕기를 바랍니다!
mysql_install_db –-user=mysql --ldata=/var/lib/mysql
Centos 7에서 나를 위해 일했습니다.
내 문제의 근원은 OS 설치시 자동으로 켜진 (강제) selinux 인 것 같습니다.
/ data에 mysql을 원했습니다.
my.cnf에 다음이 있는지 확인한 후 :
datadir=/data/mysql
(그리고 소켓은 / var / lib / mysql에 남겨 둡니다) mysqld에 대해 selinux를 끄는 명령을 실행했습니다 (또는 완전히 끄는 것입니다).
setsebool -P mysqld_disable_trans=1
다음 명령을 실행했습니다.
> chown -R mysql .
> chgrp -R mysql .
> mysql_install_db --user=mysql
나는 mysql 데몬을 시작했고 그 후 모든 것이 잘 작동했습니다.
Windows에서 시작하기 전에 mysql을 초기화하십시오.
mysqld --initialize
mysql zip 버전을 다운로드 할 때 mysqld를 직접 실행하면 다음 오류가 표시됩니다. 2016-02-18T07 : 23 : 48.318481Z 0 [오류] 치명적인 오류 : 권한 테이블을 열고 잠글 수 없음 : 테이블 'mysql.user' 존재하지 않습니다 2016-02-18T07 : 23 : 48.319482Z 0 [오류] 중단 중
먼저 아래 명령을 실행해야합니다 : mysqld --initialize
이 명령 전에 데이터 폴더가 비어 있는지 확인하십시오.
datadir을 이동하는 경우 새 datadir 권한을 부여해야 할뿐만 아니라 모든 상위 디렉토리에 권한이 있는지 확인해야합니다.
데이터 디렉토리를 Ubuntu에 다음과 같이 마운트 된 하드 드라이브로 옮겼습니다.
/media/*user*/Data/
내 datadir은 Databases 였습니다 .
각 미디어, 사용자 및 데이터 디렉터리 에 대한 권한을 771로 설정해야했습니다 .
sudo chmod 771 *DIR*
이것이 작동하지 않으면 mysql을 작동시키는 또 다른 방법은 /etc/mysql/my.cnf의 사용자를 root로 변경하는 것입니다. 보안 관점에서 그렇게하는 데에는 의심의 여지가없는 몇 가지 문제가 있습니다.
OSX에서 mysql 5.7에서 동일한 문제를 만났습니다.
rm -rf {datadir}
mysqld --initialize --datadir {datadir}
mysqld --datadir {datadir}
나 자신을 위해 다음을 수행해야했습니다.
yum remove mysql*
rm -rf /var/lib/mysql/
cp /etc/my.cnf ~/my.cnf.bkup
yum install -y mysql-server mysql-client
mysql_install_db
chown -R mysql:mysql /var/lib/mysql
chown -R mysql:mysql /var/log/mysql
service mysql start
그런 다음 데이터베이스로 돌아와서 처음에 핵을 뚫은 후 다시 구성 할 수있었습니다.
이 명령만으로도 centos 6.6에서 마법을 수행 할 수 있습니다.
mysql_install_db
제 경우에는 MySQL 데이터 폴더의 경로에 특수 문자 "ç"가 있었는데 이로 인해 ...
치명적인 오류 : 권한 테이블을 열고 잠글 수 없음 : 테이블 'mysql.host'가 존재하지 않습니다.
모든 특수 문자를 제거했으며 모든 것이 작동합니다.
On CentOS EL 6 and perhaps on earlier versions there is one way to get into this same mess.
Install CentOS EL6 with a minimal installation. For example I used kickstart to install the following:
%packages
@core
acpid
bison
cmake
dhcp-common
flex
gcc
gcc-c++
git
libaio-devel
make
man
ncurses-devel
perl
ntp
ntpdate
pciutils
tar
tcpdump
wget
%end
You will find that one of the dependencies of the above list is mysql-libs
. I found that my system has a default my.cnf
in /etc
and this contains:
[mysqld]
dataddir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
When you build from the Generic Linux (Architecture Independent), Compressed TAR Archive
your default data directory is /usr/local/mysql/data
which conflicts with the /etc/my.cnf
already present which defines datadir=/var/lib/mysql
. Also the pid-file
defined in the same file does not have permissions for the mysql user/group to write to it in /var/run/mysqld
.
A quick remedy is to mv /etc/my.cnf /etc/my.cnf.old
which should get your generic source procedure working.
Of course the experience is different of you use the source RPMs.
I had the same issue in trying to start the server and followed the "checked" solution. But still had the problem. The issue was the my /etc/my.cnf file was not pointing to my designated datadir as defined when I executed the mysql_install_db with --datadir defined. Once I updated this, the server started correctly.
If you have a server which used to happily run MySQL, but now gives this error, then an uninstall and re-install of MySQL is overkill.
In my case, the server died and took a few disk blocks with it. This affected a few files, including /var/lib/mysql/mysql/host.frm and /var/lib/mysql/mysql/proc.frm
Luckily, I could copy these from another server, and this got me past that table error.
I got similar error on overlayfs (overlay2) that is the default on Docker for Mac. The error happens when starting mysql on the image, after creating a image with mysql.
2017-11-15T06:44:22.141481Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table storage engine for 'user' doesn't have this option
Switching to "aufs" solved the issue. (On Docker for Mac, the "daemon.json" can be edited by choosing "Preferences..." menu, and selecting "Daemon" tab, and selecting "Advanced" tab.)
/etc/docker/daemon.json :
{
"storage-driver" : "aufs",
"debug" : true,
"experimental" : true
}
Ref:
https://github.com/moby/moby/issues/35503
https://qiita.com/Hige-Moja/items/7b1208f16997e2aa9028
My case on Ubuntu 14.04.2 LTS was similar to others with my.cnf, but for me the cause was a ~/.my.cnf that was leftover from a previous installation. After deleting that file and purging/re-installing mysql-server, it worked fine.
'Program Tip' 카테고리의 다른 글
주어진 텍스트 파일에서 모든 공백을 제거하는 방법 (0) | 2020.12.03 |
---|---|
JavaScript에서 객체 배열을 인쇄하는 방법은 무엇입니까? (0) | 2020.12.03 |
UIViewController에서 applicationDidBecomeActive를 어떻게 사용할 수 있습니까? (0) | 2020.12.02 |
Laravel은 요청 배열에 값을 추가하는 방법이 있습니다. (0) | 2020.12.02 |
ConfigParser.items ( '')를 사전으로 변환 (0) | 2020.12.02 |