Home Database Mysql Tutorial mysql启动提示mysql.host 不存在,启动失败的解决方法

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

Jun 07, 2016 pm 06:05 PM
does not exist Startup failed

我将s9当众原来的mysql4.0删除后,重新装了个mysql5.0,启动过程中报一下错误,启动失败,查了一下群里面的老帖子也没有个具体的明确说明

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管理工具!

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打開服務窗口,查看MySQL service是否已經存在。如已经存在并已启动,则先停止该服务,然后到注冊表("HKEY_LOCAL_MACHINE\SYSTEM \CurrentControlSet\Services")中刪除對應服務,并使用命令sc delete MySQL,然后繼續進行安裝,就能成功。
MYSQL安装出现could not start the service mysql error:0处理
当各位在安装、重装时出现could not start the service mysql error:0的错误时,可以尝试下面两种方法。
一、方式1
MySQL安装是出现could not start the service mysql error:0 提示错误,解决方法:
首 先,在管理工具->服务里面将MySQL的服务给停止,然后打开cmd 进入你的MySQL bin目录下,例如 C:\Program Files\MySQL\MySQL Server 5.0\bin 然后使用如下命令mysqld-nt -remove 然后就会显示......success! 好了下面进入添加删除程序,找到MySQL选择卸载,记得选择remove。最后将MySQL目录删除,还有数据库的目录也删除。
一、方式2
查看服务中有没有mysql,如果有将该服务停掉;
安装mysql 5.1.33,在运行Server Instance Configuration wizard时的Execute configurattion步骤中的第三项Start Service进出错,错误提示为Could not start the service MySQL (出现这种情况一般是因为装过mysql,卸载不干净造成的。卸载后重启后再重装。注意看下服务,如果未能卸载,可以用mysqld-nt -remove卸载)。
在控制面板中运行添加删除程序,将mysql卸载;
卸载后打开,查看HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services 下的键值,如果有相关mysql键值(mysql、mysqladmin)则删掉,即可;
重启,将mysql的安装残余目录删掉 (查看服务,此时服务中已没有mysql);
重新安装mysql.安装后先不要运行Server Instance Configuration wizard,重启后在开始菜单中运行该向导,即可。
系统 mysql-5.0.81
提示:1045 access denied for user 'root'@'localhost' using password yes
MySQL 5.1 安装过程中报apply security setting错误的解决办法 收藏
Mysql安装错误apply security settings 解决方法
The security settings could not be applied to the database because the connection has failed with the following error.
Error Nr. 1045
Access denied for user 'root'@'localhost' (using password: YES)
If a personal firewall is running on your machine, please make sure you have opened the TCP port 3306 for connections. Otherwise no client application can connect to the server. After you have opened the port please press [Retry] to apply the security settings.
If you are re-installing after you just uninstalled the MySQL server please note that the data directory was not removed automatically. Therefore the old password from your last installation is still needed to connect to the server. In this case please select skip now and re-run the Configuration Wizard from the start menu.
MySQL 5.1 安装过程中报apply security setting错误的解决办法
1, 卸载MySQL
2, 删除目录 C:\Documents and Settings\All Users\Application Data\MySQL
3, 重新安装MySQL 就 OK 啦
------------------------------------------
[MySQL] Could not start the service MySQL 解决方法
安装mysql 5.1.33,在运行Server Instance Configuration wizard时的Execute configurattion步骤中的第三项Start Service进出错,错误提示为Could not start the service MySQL (出现这种情况一般是因为装过mysql,卸载不干净造成的。卸载后重启后再重装。注意看下服务,如果未能卸载,可以用mysqld-nt -remove卸载)。
具体方法如下:
查看服务中有没有mysql,如果有将该服务停掉;
在控制面板中运行添加删除程序,将mysql卸载;
卸载后打开,查看HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services 下的键值,如果有相关mysql键值(mysql、mysqladmin)则删掉,即可;
重启,将mysql的安装残余目录删掉 (查看服务,此时服务中已没有mysql);
重新安装mysql.安装后先不要运行Server Instance Configuration wizard,重启后在开始菜单中运行该向导,即可。
PS:一种值得参考的方法
---------------------------------------------
msyql安装到最后一步start service错误解决方法
1,到控制面板里面先把mysql删除.
2.到c盘C:\Program Files目录下把mysql目录删除.
3.如果在其他盘还有设置目录也要删除.空目录也要删除
4.到regedit把
代码如下:
HKEY_LOCAL_MACHINE/SYSTEM/ControlSet001/Services/Eventlog/Applications/MySQL
HKEY_LOCAL_MACHINE/SYSTEM/ControlSet002/Services/Eventlog/Applications/MySQL
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Eventlog/Applications/MySQL

有的话,全部删除!
(技巧:用F3循环查找“mysql”)
5.如果任务管理器里有关mysql内容也删除
6,把防火墙关了
7,重新装mysql(这里我没有重启计算机)
重装时候有必要的话,重启计算机,停用IIS,和删除temp里的临时文件.
实在不行的话,配置mysql时候,把mysql服务换个服务名.
******************************************************************************************
---------------------------
删除项时出错。
---------------------------
无法删除 LEGACY_MYSQL51: 删除项时出错。
---------------------------
确定
---------------------------
解决办法:项里右键增加administrators所有权限
安装mysql时可能产生cannot create windows service for mysql.error:0错误,错误的原因多数由于重新安装mysql或者对mydql升级,使用MySQL Configuration Wizard而产生.
解决的方法:到regedit把,用F3循环查找“mysql”,全部删除,重新装mysql,即可。
Statement of this Website
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

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1672
14
PHP Tutorial
1277
29
C# Tutorial
1257
24
MySQL's Role: Databases in Web Applications MySQL's Role: Databases in Web Applications Apr 17, 2025 am 12:23 AM

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

Explain the role of InnoDB redo logs and undo logs. Explain the role of InnoDB redo logs and undo logs. Apr 15, 2025 am 12:16 AM

InnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.

MySQL vs. Other Programming Languages: A Comparison MySQL vs. Other Programming Languages: A Comparison Apr 19, 2025 am 12:22 AM

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages ​​such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages ​​have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL for Beginners: Getting Started with Database Management MySQL for Beginners: Getting Started with Database Management Apr 18, 2025 am 12:10 AM

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA

Explain the InnoDB Buffer Pool and its importance for performance. Explain the InnoDB Buffer Pool and its importance for performance. Apr 19, 2025 am 12:24 AM

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

MySQL vs. Other Databases: Comparing the Options MySQL vs. Other Databases: Comparing the Options Apr 15, 2025 am 12:08 AM

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.

MySQL: Structured Data and Relational Databases MySQL: Structured Data and Relational Databases Apr 18, 2025 am 12:22 AM

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

Learning MySQL: A Step-by-Step Guide for New Users Learning MySQL: A Step-by-Step Guide for New Users Apr 19, 2025 am 12:19 AM

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

See all articles