MySQL Installation FAQ (file not found, system service cannot start ...)

Source: Internet
Author: User
Tags mysql version

There are always problems when installing MySQL, and each reinstallation will take a lot of time to troubleshoot. In fact, there are a lot of related articles on the Internet, but many of them only talk about the method, but did not tell the details of the problem, resulting in unable to solve the problem. In fact, sometimes know the cause of the problem, but always because some of the details of the problem did not notice, repeated attempts to waste a lot of time. Now take note of the problems I encountered during the installation process and the issues that I have noticed.

Environment: Windows7

MySQL version: Mysql-5.6.10-win32

If this is the default installation, then MySQL will be installed in the directory C:\Program files\mysql\mysql Server 5.6, especially the directory, which explains why.

In general, after the installation of MySQL, we all want to directly connect to use, but the reality is not necessarily so smooth. After the installation is complete, enter the command directly in CMD:

[Plain] View plain copy on code to view the snippet derivation to my code slice 01.c:\windows\system32>mysql-uroot 02. ' MySQL ' is not an internal or external command, nor is it a running program or batch file.

This is due to the absence of configuration environment variables, of course, you can switch to the MySQL installation directory and then execute the command, but it is not a problem.

first configure the environment variables , add the bin directory of the MySQL directory to the PATH environment variable (how to set the specific operation of environment variables omitted, can Google a lot).

After you've configured the environment variables, you can connect to MySQL? Try Mysql-uroot, hey, what's going on:

[Plain] View plain copy on code to view the chip derivation to my Code slice 01.c:\windows\system32>mysql-uroot 02.ERROR 2003 (HY000): Can ' t connect t o MySQL server on ' localhost ' (10061)

What's the reason? Is the service not started to start the service to look at:

[Plain] View plain copy on code to view the snippet derivation to my Code slice 01.c:\windows\system32>net start MySQL 02. The service name is invalid. 03.04. Please type NET helpmsg 2185 for more help.

The service name is invalid? When I open the Windows service, it turns out that MySQL service is not installed at all after MySQL installation, we need to install it manually.

The service for installing MySQL is " simple " and is entered on the command line:

[HTML] View plain copy on code to see a snippet derived from my Code slice 01.c:\users\mikanmu>mysqld--install 02.install/remove of the Service Denie D!

Hey, what's going on? This is due to a lack of permissions and requires that you run as an administrator when you start the command line. Close the current CMD window to run as Administrator again:

[Plain] View plain copy on code to view the snippet derivation to my Code slice 01.C:\WINDOWS\SYSTEM32>MYSQLD--install 02.Service successfully installed.

Prompt to install successfully. Well, after installing the service, start up and look at:

[Plain] View plain copy on code to view the snippet derivation to my Code slice 01.c:\windows\system32>net start MySQL 02. System error 2 occurred. 03.04. The system cannot find the file specified.

I got a go, what's going on here? All kinds of Internet search, it is said that you need to add the path in the MySQL configuration file:

Basedir=c:/program files/mysql/mysql Server 5.6 datadir=c:/program files/mysql/mysql Server 5.6/data

All right, I'll try, Mysql-5.6.10-win32. The default configuration file is C:/Program files/mysql/mysql Server 5.6/ My-default.ini, or create a My.ini file yourself, where you add the configuration:

[Mysqld] basedir=c:/program files/mysql/mysql Server 5.6 datadir=c:/program files/mysql/mysql Server 5.6/data

Note: 1, the installation directory because of the permissions can not directly establish the file, you need to establish and add the appropriate configuration in other places, and then copied to the installation directory C:/Program Files/mysql/mysql Server 5.6.

2, on-line some said the directory delimiter in the configuration must be a forward slash '/', but after the experiment, '/', ' \ ', ' \ \ ' are no problem, all is possible.

3, Basedir This configuration is the installation directory of MySQL, remember, must be configured to C:/Program files/mysql/mysql Server 5.6 This directory, not to C:/Program Files/mysql will be finished.

4. The My.ini file must be encoded in English (such as ANSI in Windows), not UTF-8 or GBK, etc.

After the above operation is completed (be sure to pay attention to the details), then to start the service:

[Plain] View plain copy on code to view the snippet derivation to my Code slice 01.c:\windows\system32>net start MySQL 02. System error 2 occurred.  03.04. 05. The system cannot find the file specified.

Why are you still reporting this mistake? Isn't it because of the configuration? Yes, not because of the above configuration problem, but the above configuration is not wrong after adding. What's the reason?

Here is the most important thing to note, when installing the MySQL service, be sure to switch to the MySQL installation directory in the bin directory, regardless of whether you configure the environment variable, or after the installation, the service will be started to report the above error.

After switching to the bin directory, remove the previously installed MySQL service (the removal service does not have to go to the bin directory), and then re-install the MySQL service in the bin directory, and then start: Be sure to CD: Enter the bin directory even if you have an environment variable

[Plain] View plain copy on code to view the snippet derived from my Code slice 01.C:\WINDOWS\SYSTEM32>CD:  /..  03.C:\>CD program Files\mysql\mysql Server 5.6\bin 04.  05.c:\program files\mysql\mysql Server 5.6\bin>mysqld--remove 06.Service successfully removed.  08.c:\program files\mysql\mysql Server 5.6\bin>mysqld--install 09.Service successfully installed.  11.c:\program files\mysql\mysql Server 5.6\bin>net start MySQL 12.MySQL service is starting. 13.MySQL Service has started successfully.

Wow, finally succeeded!!

Now to verify that you do not need to add the My.ini file, you can start the service normally, as long as the service is installed in the bin directory. Only need to stop the MySQL service, delete the service, then the MySQL installation directory My.ini file deleted, and then reinstall the service, start the MySQL service, see if it can start normally, the experiment proves that it can start normally.

[Plain] View plain copy on code to view the chip derivation to my Code slice 01.c:\program files\mysql\mysql Server 5.6\bin>net stop MySQL 02.MySQL service is  At the stop.  The 03.MySQL service has stopped successfully.  05.c:\program files\mysql\mysql Server 5.6\bin>mysqld--remove 06.Service successfully removed.  08.c:\program files\mysql\mysql Server 5.6\bin>mysqld--install 09.Service successfully installed.  11.c:\program files\mysql\mysql Server 5.6\bin>net start MySQL 12.MySQL service is starting. 13.MySQL Service has started successfully.

Finally done!!! See if you can connect:

[Plain] View plain copy on code to view the chip derivation to my Code slice 01.c:\program files\mysql\mysql Server 5.6\bin>mysql-uroot 02.Welcome to  The MySQL Monitor. Commands End With;  or \g.  03.Your MySQL Connection ID is 3 04.Server version:5.6.10 mysql Community Server (GPL) 05. 06.Copyright (c), Oracle and/or its affiliates.  All rights reserved. 08.Oracle is a registered trademark of the Oracle Corporation and/or its 09.affiliates.  Other names trademarks of their respective 10.owners. 12.Type ' help, ' or ' \h ' for help.  Type ' \c ' to clear the current input statement. 14.mysql>.

No problem at all.

In addition, MySQL default root user is not set password, we can modify the root user password, the method is as follows:

1, directly in the cmd command line, do not need to enter MySQL

[Plain] View plain copy on code to view the chip derivation to my Code slice 01.mysqladmin-u root password ' new password '

2. In MySQL, be sure to connect to a database

[Plain] View plain copy on code to view the chip derivation to my code slice 01.mysql> use MySQL 02.Database changed 03.mysql> update user set Pass  Word=password (' new password ') where user= ' root ';  04.Query OK, 3 Rows Affected (0.00 sec) 05.Rows Matched:3 changed:3 warnings:0 06.  07.mysql> flush Privileges; 08.Query OK, 0 rows Affected (0.00 sec)

MySQL Installation FAQ (file not found, system service cannot start ...)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.