search
HomeDatabaseMysql Tutorialmysql启动提示mysql.host 不存在,启动失败的解决方法_MySQL

bitsCN.com error 日志当中的记录:

[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

从发了帖子,只有人看,没有人回复,看到这种情况只能自己解决问题了,自己动手丰衣足食吗, 嗯。。。 你还别说,还真让我解决了问题,人啊,都是逼出来的,....没有办法,这个问题对于高手可能是很简单的问题 ,但是对我第一次摸mysql,确实怎么也弄不懂的问题。
好了闲话不多说 说一下我解决的过程:

按照mysql的安装步骤:
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> gunzip shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql
shell> make
shell> make install
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root /usr/local/mysql
shell> chown -R mysql /usr/local/mysql/var
shell> chgrp -R mysql /usr/local/mysql
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> /usr/local/mysql/bin/mysqld_safe --user=mysql &

这样标准进行下来是没有问题的,但在最后一步启动mysql的时候我希望将数据库的数据文件放在另外一个目录下面,启动命令修改为:
shell>/usr/local/mysql/bin/mysqld_safe --user=mysql --log-error=/u01/mysql/mysql_error/error --datadir=/u01/mysql/data

这个时候就出现问题了, 因为在进行初始化数据库权限表的那一步的时候默认创建的权限表在默认目录/usr/local/mysql/var下面,这就造成了,上面的错误无法找到 权限表:Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

解决办法 在运行初始化权限表的时候使用增加参数--datadir ,命令格式为:
shell> scripts/mysql_install_db --user=mysql --datadir=/u01/mysql/data
这样问题就解决了。
这样问题同样也会出现 你将自己的数据库的数据文件修改为别的目录的时候,因为你没有在相应的目录下创建数据库权限表,解决办法就是你重新运行mysql_install_db 文件,重新生成数据库权限表,但是相应的你也要重新建里用户,以及设置权限; 第二个办法应该将老的权限表的文件拷贝倒相应数据库表对应的目录先即可,但是第二个办法我没有用过只是根据自己的想象猜的。如果有高手请给确认一下是否正确

MySQL 提示服务启动失败的解决办法

以前经常碰到这个问题,但都是用以下办法处理的,

先在添加删除程序里卸载MySQL,然后把原MySQL的目录改名,再打开注册表用F3循环查找“MySQL”,全部删除,最后重启机器再重新装MySQL都可以搞定,但今天遇到的问题比特殊,按上面和下面的办法全试过了依然不行,安装到最后一到启动那里就失败了,把所有正在运行的服务和软件全部关掉,又连续重启重装了N次都是到那里停止,后来干脆换个高版本儿试下,这次全部删除后重装到最后那一步时还是等了很长时间,最后竟然成功了,现在记录下来,以后再遇到此类问题不用再郁闷了!

重装是成功了,但是重启后测试发现又出问题了,服务启动不了,一直报错如下:
在 本地计算机 无法启动 MySQL 服务。
错误 1053: 服务没有及时响应启动或控制请求。

又研究了半天,最后终于搞定,发现他原来的计算机管理员用户名里有个$字符,心想不会是他的事儿吧,就建了一个正常的独立计算机账户MySQLUSER,然后在进程里把mysqld.exe结束,然后在MySQL所在的目录上点右键属性安全,添加MySQLUSER这个用户并给完全控制权限,再打开服务管理器在MySQL服务上点右键,输入刚才建立的账号和密码确定,如下图!
mysql启动提示mysql.host 不存在,启动失败的解决方法_MySQL
最后再随意重启服务,重启计算机再试,依然很顺利,至此这个疑难问题算是彻底解决,问题根源就是那个系统管理员账号内的$字符,呵呵。

附几个常用的MySQL的下载地址和MySQL管理工具!

http://sys.7i24.com/soft/mysql5132.rar
http://sys.7i24.com/soft/mysql5158.rar
http://mysql.he.net/Downloads/MySQL-5.5/mysql-5.5.21-win32.msi

MySQL 5.5.12 官方版(For Windows 64位)
thunder://QUFodHRwOi8veGlhemFpLnhpYXphaWJhLmNvbS9Tb2Z0L00vTXlTUUxfNS41LjEyX3dpbng2NF9YaWFaYWlCYS56aXBaWg==

● Navicat for MySQL V9.0.15 绿色中文版_优秀的数据库管理和开发工具
thunder://QUFodHRwOi8vd3d3dy4xMTkueGRvd25zLmNvbS91cGxvYWRGaWxlLzIwMTAtMTAvbmF2aWNhdF9mb3JfTXlTUUwucmFyWlo=


================以下是遇到此类问题时的常规处理办法========================
mysql 安装到最后一步时,start service 为失败状态 请问是什么原因

使用services.msc打

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
PHP Fatal error: Call to undefined method PDO::prepare() in的解决方法PHP Fatal error: Call to undefined method PDO::prepare() in的解决方法Jun 22, 2023 pm 06:40 PM

PHP作为一种流行的Web开发语言,已经被使用了很长时间。PHP中集成的PDO(PHP数据对象)类是我们在开发Web应用程序过程中与数据库进行交互的一种常用方法。但是,一些PHP开发者经常遇到的问题是,当使用PDO类与数据库进行交互时,他们会收到这样的错误:PHPFatalerror:CalltoundefinedmethodPDO::prep

在Vue应用中使用axios时出现“Uncaught (in promise) Error: Request failed with status code 500”怎么办?在Vue应用中使用axios时出现“Uncaught (in promise) Error: Request failed with status code 500”怎么办?Jun 24, 2023 pm 05:33 PM

在Vue应用中使用axios是十分常见的,axios是一种基于Promise的HTTP客户端,可以用于浏览器和Node.js。在开发过程中,有时会出现“Uncaught(inpromise)Error:Requestfailedwithstatuscode500”的错误提示,对于开发者来说,这个错误提示可能有些难以理解和解决。本文将会探讨这

解决C++代码中出现的“error: incomplete type is not allowed”问题解决C++代码中出现的“error: incomplete type is not allowed”问题Aug 26, 2023 pm 08:54 PM

解决C++代码中出现的“error:incompletetypeisnotallowed”问题在C++的编程过程中,有时候会遇到一些编译错误,其中一个常见的错误是“error:incompletetypeisnotallowed”。这个错误通常是由于在使用不完整的类型进行操作时引起的。本文将介绍这个错误的原因,并提供几种解决方法。首先,我

0271:real time clock error开不开机怎么办0271:real time clock error开不开机怎么办Mar 13, 2023 am 11:30 AM

“0271:real time clock error”开不开机的解决办法:1、按一下F1,在出现的界面中,将选项栏转到第三项“Date/Time”;2、将系统时间手动修改成现在的时间;3、按F10,在弹出的对话框中,选择yes;4、重新打开笔记本即可正常开机。

解决C++代码中出现的“error: expected initializer before 'datatype'”问题解决C++代码中出现的“error: expected initializer before 'datatype'”问题Aug 25, 2023 pm 01:24 PM

解决C++代码中出现的“error:expectedinitializerbefore'datatype'”问题在C++编程中,有时候我们在编写代码时会遇到一些编译错误,其中一种常见的错误是“error:expectedinitializerbefore'datatype'”。这个错误通常在变量声明或函数定义中发生,可能导致程序无法正确编译或

如何解决PHP Warning: fopen(): failed to open stream: No such file or directory如何解决PHP Warning: fopen(): failed to open stream: No such file or directoryAug 19, 2023 am 10:44 AM

如何解决PHPWarning:fopen():failedtoopenstream:Nosuchfileordirectory在使用PHP开发过程中,我们经常会遇到一些文件操作的问题,其中之一就是"PHPWarning:fopen():failedtoopenstream:Nosuchfileordirectory

PHP Fatal error: Call to undefined function mysqli_connect()的解决方法PHP Fatal error: Call to undefined function mysqli_connect()的解决方法Jun 23, 2023 am 09:40 AM

在使用PHP编写Web应用程序时,经常会使用MySQL数据库来存储数据。PHP提供了一种与MySQL数据库进行交互的方法,称为MySQLi。然而,有时在使用MySQLi时,会遇到一个错误信息,如以下所示:PHPFatalerror:Calltoundefinedfunctionmysqli_connect()这个错误信息意味着PHP无法找到my

PHP Fatal error: Call to a member function fetch()的解决方法PHP Fatal error: Call to a member function fetch()的解决方法Jun 23, 2023 am 09:36 AM

在使用PHP进行web应用开发时,很多时候会需要使用数据库。而在使用数据库时,错误提示是非常常见的事情。其中,PHPFatalerror:Calltoamemberfunctionfetch()是一种比较常见的错误,它会在使用PDO查询数据库时出现。那么,这个错误是怎么引起的,以及如何解决呢?本文将为大家详细阐述。一、错误产生原

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),