Home Database Mysql Tutorial Windows下对MySQL安装的故障诊断与排除_MySQL

Windows下对MySQL安装的故障诊断与排除_MySQL

Jun 01, 2016 pm 01:55 PM
windows server material

  首次安装、运行MySQL时,你可能会遇到一些错误,使MySQL服务器不能启动。本节的目的是帮助你诊断并纠正这些错误。

  解决服务器问题时你的第一资料是错误日志。MySQL服务器使用错误日志来记录服务器不能启动的信息。错误日志位于my.ini文件指定的数据目录中。默认数据目录位于C:Program FilesMySQLMySQL Server 5.1dat。

  另一个错误相关信息源是MySQL服务启动时控制台上显示的消息。将mysqld安装为服务后,从命令行通过NET START mysql命令来查看MySQL服务启动相关的错误消息。

  下面距离说明了首次安装并启动MySQL服务时会遇到的最常见的错误消息:

  ?System error 1067 has occurred.

  ?Fatal error: Can't open privilege tables: Table 'mysql.host' doesn't exist

  ?当MySQL服务器找不到MySQL权限数据库或关键文件时会出现这些消息。当MySQL基或数据目录没有安装在默认位置(C:mysql和 C:Program FilesMySQLMySQL Server 5.1data),而是安装到其它位置时通常会遇到该问题。

  发生该问题的一种情况是对MySQL进行升级或安装到了新位置,但是没有对配置文件进行更新以对应新的安装位置。此外还可能是新旧配置文件冲突,当升级MySQL时,一定要删除或重新命名旧的配置文件。

  如果你没有将MySQL安装到C:Program FilesMySQLMySQL Server 5.1目录下,而是安装到了其它目录下,你需要通过使用配置(my.ini)文件让MySQL服务器知道安装目录。my.ini文件应位于Windows目录下,典型为C:WINNT或C:WINDOWS。可以在命令提示符下输入下面的命令从WINDIR环境变量值中确定确切位置:

  C:> echo %WINDIR%可以通过文本编辑器(例如记事本)来创建并修改选项文件。例如,如果MySQL安装在E:mysql下,数据目录在D:MySQLdata,你可以创建选项文件并设置[mysqld]来指定basedir和datadir参数的值:

[mysqld]
# set basedir to your installation path
basedir=E:/mysql
# set datadir to the location of your data directory
datadir=D:/MySQLdata

  请注意应使用(正)斜线而不是反斜线在选项文件中指定Windows路径名。如果使用反斜线,则必须使用双斜线:

[mysqld]
# set basedir to your installation path
basedir=C:Program FilesMySQLMySQL Server 5.1
# set datadir to the location of your data directory
datadir=D:MySQLdata

  如果在MySQL配置文件中更改datadir值,在重新启动MySQL服务器之前,必须移动已有MySQL数据目录中的内容。

?Error: Cannot create Windows service for MySql. Error: 0

  ? 当你没有事先停止并卸载已有MySQL服务,并且使用MySQL Configuration Wizard(配置向导)重新安装或升级MySQL时,会遇到该问题。发生的原因是,当配置向导试图安装服务时,它发现已经有一个同名的服务。

  解决该问题的一个方案是使用配置向导时选择mysql之外的其它服务名。这样可以正确安装新服务,但保留了原来的服务。但是这样不好,最好是卸掉不再使用的旧服务。

  要想永远卸掉旧的MySQL服务,通过管理权限用户在命令行执行下面的命令:

C:>sc delete mysql
[SC] DeleteService SUCCESS

  如果Windows版本中没有sc工具,可以下载delsrv工具并使用delsrvMySQL语法。

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

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)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
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)

What should I do if I can't delete a Windows system dll file? Tips for completely deleting stubborn dll files What should I do if I can't delete a Windows system dll file? Tips for completely deleting stubborn dll files Jun 12, 2024 pm 02:46 PM

For some stubborn software, residual dll files will remain after uninstallation, and this dll file cannot be deleted. Some of them will be bound to the process (generally easy to bind to the expore.exe process) and start up when the computer is turned on. , when deleting a file, you will be prompted that a program is occupied (or a service is running, etc.). Method 1: 1. After pressing the win+r key, an interface will appear, and then enter regedit. The screenshot is as follows: 2. Then press Enter and we You will enter the Registry Editor, the screenshot is as follows: 3. At this time we will find the "HKEY_LOCAL_MACHINE" file in "My Computer", and then click to expand--SOFTWAR

Lossless Scaling on Steam Deck OLED runs games at up to 2x FPS Lossless Scaling on Steam Deck OLED runs games at up to 2x FPS Aug 26, 2024 am 10:07 AM

ETA Prime recently showcased a paid software called Lossless Scaling on ROG Ally X. While it doesn't actually improve the actual gaming performance, the software enhances the experience by adding frame generation and resolution scaling. These two can

deepseek web version entrance deepseek official website entrance deepseek web version entrance deepseek official website entrance Feb 19, 2025 pm 04:54 PM

DeepSeek is a powerful intelligent search and analysis tool that provides two access methods: web version and official website. The web version is convenient and efficient, and can be used without installation; the official website provides comprehensive product information, download resources and support services. Whether individuals or corporate users, they can easily obtain and analyze massive data through DeepSeek to improve work efficiency, assist decision-making and promote innovation.

How to update the latest version of Bybit Exchange? Will there be any impact if it is not updated? How to update the latest version of Bybit Exchange? Will there be any impact if it is not updated? Feb 21, 2025 pm 10:54 PM

The way to update ByBit exchanges varies by platform and device: Mobile: Check for updates and install in the app store. Desktop Client: Check for updates in the Help menu and install automatically. Web page: You need to manually access the official website for updates. Failure to update the exchange can lead to security vulnerabilities, functional limitations, compatibility issues and reduced transaction execution efficiency.

Pi Node Teaching: What is a Pi Node? How to install and set up Pi Node? Pi Node Teaching: What is a Pi Node? How to install and set up Pi Node? Mar 05, 2025 pm 05:57 PM

Detailed explanation and installation guide for PiNetwork nodes This article will introduce the PiNetwork ecosystem in detail - Pi nodes, a key role in the PiNetwork ecosystem, and provide complete steps for installation and configuration. After the launch of the PiNetwork blockchain test network, Pi nodes have become an important part of many pioneers actively participating in the testing, preparing for the upcoming main network release. If you don’t know PiNetwork yet, please refer to what is Picoin? What is the price for listing? Pi usage, mining and security analysis. What is PiNetwork? The PiNetwork project started in 2019 and owns its exclusive cryptocurrency Pi Coin. The project aims to create a one that everyone can participate

How to install deepseek How to install deepseek Feb 19, 2025 pm 05:48 PM

There are many ways to install DeepSeek, including: compile from source (for experienced developers) using precompiled packages (for Windows users) using Docker containers (for most convenient, no need to worry about compatibility) No matter which method you choose, Please read the official documents carefully and prepare them fully to avoid unnecessary trouble.

Snapdragon X Elite CPU performance nearly identical on battery and plugged-in in Vivobook S15 benchmarks Snapdragon X Elite CPU performance nearly identical on battery and plugged-in in Vivobook S15 benchmarks Jun 20, 2024 pm 03:59 PM

Despite the hype surrounding the Qualcomm Snapdragon X Elite, it has been a rather mediocre launch. In our review, we found that the most impressive part of the new Qualcomm Snapdragon X Elite X1E-78-100-powered Asus Vivobook S 15 was the seamlessnes

Snapdragon X Elite CPU performance nearly identical on battery vs AC power in Vivobook S15 benchmarks Snapdragon X Elite CPU performance nearly identical on battery vs AC power in Vivobook S15 benchmarks Jun 21, 2024 am 06:50 AM

Despite the hype surrounding the Qualcomm Snapdragon X Elite, it has been a rather mediocre launch. In our review, we found that the most impressive part of the new Qualcomm Snapdragon X Elite X1E-78-100-powered Asus Vivobook S 15 was the seamlessnes

See all articles