Mysql installation FAQ (the specified file is not found in the system, and the system error 1067_MySQL occurs.

Source: Internet
Author: User
Mysql installation FAQ (the specified file is not found in the system and the system error occurs. 1067 the process is terminated unexpectedly) bitsCN.com

When installing mysql, you will always encounter such problems. every time you reinstall mysql, it will take a lot of time to troubleshoot. There are actually a lot of related articles on the Internet, but many of them only talk about the method, but do not talk about the specific details, leading to the failure to solve the problem. In fact, sometimes you know the cause of the problem, but it is always because you have not noticed some details. repeated attempts waste a lot of time. Now, let's record the problems I encountered during the installation process and the issues that I should pay attention.

Environment: Windows 7

Mysql version: mysql-5.6.10-win32

If it is installed by default, mysql will be installed in the directory C:/Program Files/MySQL Server 5.6. pay special attention to this directory. The following describes the causes.

In general, after installing mysql, we all want to connect directly, but the actual situation may not be smooth. After the installation is complete, enter the following command in CMD:

C:/Windows/system32> mysql-uroot 'mysql' is not an internal or external command, or a program or batch file that can be run.

This is caused by the absence of environment variables. of course, you can switch to the mysql installation directory before executing the command, but isn't that troublesome.

First, configure the environment variable and add the bin directory of the mysql directory to the path environment variable (the specific operation on how to set the environment variable is omitted can be implemented by google ).

After environment variables are configured, can I connect to mysql? Try mysql-uroot and slave. what is going on:

C:/Windows/system32>mysql -urootERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

Why? Is the service not started? let's start the service:

C:/Windows/system32> net start mysql service name is invalid. Type net helpmsg 2185 for more help.

Why is the service name invalid? Open the windows service and check that the mysql service is not installed after mysql is installed. we need to install it manually.

The mysql installation service is "simple". enter the following in the command line:

C:/Users/MikanMu>mysqld --installInstall/Remove of the Service Denied!

Why? This is because you do not have the permission. you must run the command as an administrator when starting the command. Close the current cmd window and run it as an administrator again:

C:/Windows/system32>mysqld --installService successfully installed.

Prompt that the installation is successful. Good. after installing the service, start up and look at it:

C:/Windows/system32> net start mysql system error 2. The system cannot find the specified file.

I went there. why? You need to add the path to the mysql configuration file for various checks on the Internet:

Basedir = C:/Program Files/MySQL Server 5.6
Datadir = C:/Program Files/MySQL Server 5.6/data

Okay, I'll try, the default configuration file for the mysql-5.6.10-win32 is in C:/Program Files/MySQL Server 5.6/my-default.ini, or create a my. ini file yourself and add configuration in it:

[Mysqld]
Basedir = C:/Program Files/MySQL Server 5.6
Datadir = C:/Program Files/MySQL Server 5.6/data

Note: 1. files cannot be directly created in the installation directory due to permission reasons. you need to create and add the corresponding configuration elsewhere, and then copy it to the installation directory C: /Program Files/MySQL Server 5.6.

2. some online users say that the directory delimiter in the configuration must be a forward slash '/', but after the experiment, '/', '/', and '/' are all correct, yes.

3. the basedir configuration is the installation directory of mysql. Remember, it must be configured to the directory C:/Program Files/MySQL Server 5.6, and cannot go to C: /Program Files/MySQL is complete.

4, my. ini file encoding must be English code (such as ANSI in windows), cannot be a UTF-8 or GBK.

After the above operations are completed (pay attention to the details), start the service again:

C:/Windows/system32> net start mysql system error 2. The system cannot find the specified file.

Why is this error reported? Isn't it because of configuration? Yes, it is not because of the above configuration problems, but there is no error after the above configuration is added. Why?

This is the most important thing to note. when installing the mysql service, you must switch to the bin directory of the mysql installation directory, whether or not you have configured the environment variables, otherwise, the preceding error is reported when the service is started after installation.

After switching to the bin directory, first delete the mysql service installed earlier (the Delete service does not have to go to the bin directory), then reinstall the mysql service in the bin directory, and then start:

C:/Windows/system32> cd .. /.. c:/> cd Program Files/MySQL Server 5.6/binC:/Program Files/MySQL Server 5.6/bin> mysqld -- removeService successfully removed. c:/Program Files/MySQL Server 5.6/bin> mysqld -- installService successfully installed. c:/Program Files/MySQL Server 5.6/bin> net start mysqlMySQL service is being started. the MySQL service has been started successfully.

Wow, it succeeded !!

Now let's verify that the my. ini file does not need to be added and the service can be started normally, as long as the service is installed in the bin directory. You only need to stop the mysql service, delete the service, and then put my. delete The INI file, reinstall the service, and start the mysql service to check whether the service can be started properly. the experiment proves that the service can be started normally.

C:/Program Files/MySQL Server 5.6/bin> net stop mysqlMySQL service is stopping. MySQL service has stopped successfully. C:/Program Files/MySQL Server 5.6/bin> mysqld -- removeService successfully removed. c:/Program Files/MySQL Server 5.6/bin> mysqld -- installService successfully installed. c:/Program Files/MySQL Server 5.6/bin> net start mysqlMySQL service is being started. the MySQL service has been started successfully.

The final success !!! Check whether the connection is successful:

C:/Program Files/MySQL/MySQL Server 5.6/bin>mysql -urootWelcome to the MySQL monitor.  Commands end with ; or /g.Your MySQL connection id is 3Server version: 5.6.10 MySQL Community Server (GPL)Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.mysql>

No problem at all.

In addition, the default root user of mysql does not set a password. you can modify the root user password as follows:

1. directly go to the cmd command line without entering mysql

Mysqladmin-u root password 'new password'

2. in mysql, you must connect to a database.

Mysql> use mysqlDatabase changedmysql> update user set password = password ('New password') where user = 'root'; Query OK, 3 rows affected (0.00 sec) Rows matched: 3 Changed: 3 Warnings: 0 mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)

BitsCN.com

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.