尝试启动 MySQL 时出现 1067 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4158965/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 17:42:54  来源:igfitidea点击:

1067 error on attempt to start MySQL

mysqlmysql-error-1067

提问by Eugene

I've installed MySQL on Windows 7. When I'm trying to start MySQL service I'm getting error 1067: The process terminated unexpectedly. Log message:

我在 Windows 7 上安装了 MySQL。当我尝试启动 MySQL 服务时,我收到错误 1067:进程意外终止。日志消息:

101111 22:27:11 [Note] Plugin 'FEDERATED' is disabled.
C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld: Table 'mysql.plugin' doesn't exist
101111 22:27:11 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
InnoDB: Log scan progressed past the checkpoint lsn 0 37356
101111 22:27:11  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 0 44233
101111 22:27:11  InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 86 87 88 89 90 91 92 93 94 95 96 97 98 99 
InnoDB: Apply batch completed
101111 22:27:12  InnoDB: Started; log sequence number 0 44233
101111 22:27:12 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

What can I do about it?

我该怎么办?

回答by Eugene

The solution was to install MySQL without spaces in installation path. Windows 7, 64-bit

解决方案是安装MySQL,安装路径中没有空格。Windows 7,64 位

回答by TxRegex

One more thing that prevents the mysqld windows service from running is if you have mysqld.exe already running (but not as a service) and occupying port 3306. When the service tries to start and sees that port 3306 is already taken, it fails.

阻止 mysqld windows 服务运行的另一件事是,如果 mysqld.exe 已经运行(但不是作为服务)并占用端口 3306。当服务尝试启动并看到端口 3306 已被占用时,它会失败。

Just open up the windows task manager and look for "mysqld.exe" under the Processes tab. If you see it, kill it and then try to start the service again.

只需打开 Windows 任务管理器并在“进程”选项卡下查找“mysqld.exe”。如果您看到它,请杀死它,然后再次尝试启动该服务。

c:\> net start [servicename]

example: c:\> net start MySQL

例如:c:\> net start MySQL

回答by MrMan

The solution to the problem for me was looking in my install directory, finding the /data folder, and copying it's content to the data folder that was specified in my .ini/.cnf configuration file.

我的问题的解决方案是查看我的安装目录,找到 /data 文件夹,并将其内容复制到我的 .ini/.cnf 配置文件中指定的数据文件夹。

回答by Sean

My issue happened right after a power failure. I got the error 1067 The process terminated unexpectedly. MySQL needless to say did not start. The answer was simple

我的问题发生在电源故障后。我收到错误 1067 进程意外终止。MySQL不用说没有启动。答案很简单

  1. Open mysql path\data
  2. Remove (delete) both ib_logfile0 and ib_logfile1.
  3. Start the service
  1. 打开mysql路径\数据
  2. 移除(删除)ib_logfile0 和 ib_logfile1。
  3. 启动服务

回答by Eric Chan

I just encountered a similar issue and I found that it is a permission problem. When I copy the database "data", I have to add the permission for "NETWORK SERVICE"

我刚刚遇到了类似的问题,我发现这是一个权限问题。当我复制数据库“数据”时,我必须添加“网络服务”的权限

回答by Cesar

I had the same problem. In my case, it was "user error" (although the Windows installer should have been smarter about it and prevented me from committing such an error).

我有同样的问题。就我而言,这是“用户错误”(尽管 Windows 安装程序应该更聪明并防止我犯这样的错误)。

During installation, if you make changes to the default installation paths, make sure you use the same paths for both the "Server data files" on the Custom Setup screen and then later in the "InnoDB Tablespace Settings" during the "MySQL Server Instance Configuration Wizard"

在安装过程中,如果您更改了默认安装路径,请确保在“自定义安装”屏幕上对“服务器数据文件”使用相同的路径,然后在“MySQL 服务器实例配置”期间在“InnoDB 表空间设置”中使用相同的路径巫师”

回答by sam owens

I had a problem changing the datadir in my.ini for Windows 7.

我在为 Windows 7 更改 my.ini 中的数据目录时遇到问题。

I wanted the data to be stored on a different drive and I was moving this data from another PC by copying the whole folder. I changed datadir to desired drive and saved the my.ini file with no problems.

我希望将数据存储在不同的驱动器上,我通过复制整个文件夹从另一台 PC 移动这些数据。我将 datadir 更改为所需的驱动器并毫无问题地保存了 my.ini 文件。

But mysql would not start. I opened my.ini file again and it appeared to have been changed. Then, I noticed the date on the my.ini had not changed. So I had to change the security privileges to give me write access to it.

但是mysql启动不了。我再次打开 my.ini 文件,它似乎已被更改。然后,我注意到 my.ini 上的日期没有改变。所以我必须更改安全权限才能给我写权限。

This time when I saved it, the date changed and mysql started up access to all the correct data.

这次当我保存它时,日期改变了,mysql 开始访问所有正确的数据。

回答by isuru chathuranga

Before messing with too much things, please check the user the service is trying to run as. In my case it was NETWORK this one did not have write permissions to some locations where it was needed. Changing the user to Local System Account did the trick.

If the event viewer shows any error like "Can't create test file C:\Program Files\MySQL\MySQL Server 5.6\data\XXX.lower-test", there is a high probability for this solution to work. Good luck!

在弄乱太多东西之前,请检查服务试图运行的用户。在我的情况下,它是 NETWORK,它没有对某些需要它的位置的写权限。将用户更改为本地系统帐户即可解决问题。

如果事件查看器显示任何错误,例如“无法创建测试文件 C:\Program Files\MySQL\MySQL Server 5.6\data\XXX.lower-test”,则此解决方案很有可能起作用。祝你好运!

回答by skyrail

I have mysql data folder replaced by a windows directory junction. I suspect ib_logfile0/1 and/or ibdata1 is corrupted.

我将 mysql 数据文件夹替换为 windows 目录连接。我怀疑 ib_logfile0/1 和/或 ibdata1 已损坏。

Just try to delete those files and computername.err. Then restart mysql service. That's what I did, with success.

只需尝试删除这些文件和 computername.err。然后重启mysql服务。我就是这样做的,成功了。

Copying ibdata1 files, after a full reinstallation of mysql, to the junction dir and replacing dir by the junction, restarting mysql, was not enough.

在完全重新安装 mysql 后,将 ibdata1 文件复制到连接目录并通过连接替换 dir,重新启动 mysql,是不够的。

You have to let mysql rebuild those files.

您必须让 mysql 重建这些文件。

回答by pulzarraider

Also check if all dirs which you wrote in the my.iniexists.

还要检查您在其中写入的所有目录是否my.ini存在。

My problem was that tmpdirdoeesn`t exist so MySQL daemon falls with error 1067.

我的问题是tmpdir不存在所以 MySQL 守护进程出现错误 1067。

[mysqld]
port= 3306
tmpdir = "C:/tmp"

In this case C:/tmpmust exists.

在这种情况下C:/tmp必须存在。