Can ' t connect to the MySQL server on localhost (10061) solution _mysql

Source: Internet
Author: User
Tags flush
First check that the MySQL service does not start if it does not start, start the service.

Yesterday, after restarting the server, the MySQL ' localhost ' (10061) error, began to think because the database links open too much, the database resource exhaustion, but after restarting the server, still have problems, so find solutions on the Internet. Generally as follows:

Solution:
First step
Delete the My.ini under C:\windows\
Second Step
Open C:\mysql\bin\winmysqladmin.exe Enter user name and password
The third step in DOS input mysqld-nt-remove Delete Service
Then enter the Mysqld-nt-install
Step Fourth enter MySQL to start successfully.
Other methods to refer to are:
1. Look at the Hosts file localhost is not pointing 127.0.0.1
2. If the MySQL service is not started, you can run net start MySQL.
3. Some related orders:
Mysqld-nt--install #启动Mysql
MySQL #运行Mysql
Mysql-h Ipaddress-u Username-p
Or: Directly to the bin point Mysqld.exe or Mysqld-nt.exe, see if its process can run normally, if not, then to Control Panel, service to start it, see what is wrong. If not, in addition to delete the deletion of MySQL, and then reload MySQL, generally can solve the problem, you can back up the data before installation.
Error:can ' t connect to the MySQL server on ' localhost ' (10061)
Errno.: 2003
Error Number: 2003
Problem Analysis:
Unable to connect to the MySQL server, as possible:
1, the MySQL service does not start, generally in the case of the exception of MySQL can not start, such as no available disk space, My.ini mysql basedir path set error, etc.
2, the MySQL server resource is tight, causes cannot connect.
Workaround:
1, if you are a virtual host user (buy space), then contact space to check whether MySQL normal startup, and confirm MySQL configuration information (whether for localhost);
2, if you are a stand-alone host user (with administrative host permissions), then follow the steps below to check:
1 Check disk space for remaining free space and try to keep enough disk space available.
2 Check the My.ini basedir (MySQL installation address) and DataDir (data directory storage address) and other parameters set is correct, and then restart the MySQL service.
Another way is to put the server's Windows patches.
Microsoft September 9 released the TCP/IP update patch (KB967723), if the server turned on Automatic Updates or have automatic Update software download updated this patch, then this problem will occur.
One might ask, why does the patch 9th appear, only to find the problem now?
As we all know, the server is not restarted every day, some servers may be one months or Yinianbanzai reboot once, and some may be restarted after September 9 server, so the patch is effective (I personally think so).
Patch Uninstall Method: Login to the server, access to the Control Panel---Add and Remove Programs-(check above "Show updates")
In the inside can see the updated KB967723 this patch, and then want to uninstall ordinary software like uninstall, uninstall will prompt you, if uninstall may cause the program to run error, it does not matter, choose "yes", continue to uninstall.
Uninstall completes after the program server, everything is OK!
As for the patch to repair what vulnerabilities, uninstall will appear after the server security risks, this is not to say, to MySQL normal operation, the temporary solution is the only way.

There's a case where you can solve this.
discuz! Info:can not connect to MySQL server

TIME:2007-11-13 6:25pm
Script:/bbs/index.php

Error:can ' t connect to the MySQL server on ' localhost ' (10061)
Errno.: 2003

Similar error has beed dispatched to administrator before.
The following are normal reasons:
Web forum traffic is too large, the database connection exceeds the maximum number of connections. The MySQL database service has stopped.

Workaround (for win system):
1, first to the system services to find MySQL services and start the MySQL service.
2, to the MySQL installation directory to find My.ini files, open My.ini find max_connections Modify the number of connections to 1000 restart IIS with MySQL service.

Under Window
At the command line, enter:
>CD E:\mysql\bin
>mysqladmin-u root password your password.
>mysql-u root-p
Enter Password: your password
Then you can

、、、、、、、、、、、、、、、、、
Found the root cause, in this cool moment:

The root cause of this problem is that because the password is set for the root of MySQL, rather than when the password was initially installed, use

Mysqladmin version This is not the case, it must be like this: Mysqladmin-uroot-p version, enter after entering the prompts required

The root password runs the command successfully.

The first method is in fact, do not know the root password in the case of a solution, that kind of startup without the password can go into MySQL

Inside and the root password is modified to solve the problem of forgetting the root password.


The command "mysqladmin-u root password your password" function is to modify the root user's password, which can be

Prompt to enter the original password and successful execution, also indicates that the original password is empty. After that, you will naturally be able to log in successfully with the modified password.



。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。 How do I change my password?
First of all, to declare that, in most cases, the modification of MySQL is required to have the root permissions in MySQL, so the general user can not change the password

, unless the administrator is requested.

Method One
Using phpMyAdmin, this is the easiest, to modify the MySQL library's user table,
But don't forget to use the password function.
Method Two
Using Mysqladmin, this is a special case of the previous declaration.
Mysqladmin-u root-p Password mypasswd
After entering this command, you need to enter the original password for root, and then the root password will be changed to MYPASSWD.
Change the command root to your username, and you can change your password.
Of course, if your mysqladmin is not connected to MySQL server, or you have no way to execute mysqladmin,
Then this method is ineffective.
And mysqladmin can't empty the password.
The following methods are used at the MySQL prompt and must have the root permissions of MySQL:

Method Three
Mysql> INSERT into Mysql.user (Host,user,password)
VALUES ('% ', ' Jeffrey ', PASSWORD (' biscuit '));
Mysql> FLUSH Privileges
To be exact, this is adding a user, the username is Jeffrey, and the password is biscuit.
There is this example in the MySQL Chinese reference manual, so I wrote it.
Note that you want to use the password function, and then use flush privileges.
Method Four
And method Three, just use the Replace statement
Mysql> REPLACE into Mysql.user (Host,user,password)
VALUES ('% ', ' Jeffrey ', PASSWORD (' biscuit '));
Mysql> FLUSH Privileges
Method Five
Using the Set Password statement,
Mysql> SET PASSWORD for "= PASSWORD (' biscuit ');
The password () function must also be used,
But you don't need to use flush privileges.
Method Six
Use Grant ... Identified by statement
Mysql> GRANT USAGE on *.* to "identified by ' biscuit ';
Here the password () function is unnecessary and does not require the use of flush privileges.
Note: PASSWORD () [is not] the password encryption is performed in the same way as the UNIX password encryption.
MySQL Forgot Password Solution
If MySQL is running, first kill: Killall-term mysqld.
Start Mysql:bin/safe_mysqld--skip-grant-tables &
You can enter MySQL without the need for a password.
Then it's
>use MySQL
>update User Set Password=password ("New_pass") where user= "root";
>flush privileges;
Re-kill MySQL, the normal way to start MySQL.

Linux under
Method One:
#/etc/init.d/mysql Stop
# Mysqld_safe--user=mysql--skip-grant-tables--skip-networking &
# mysql-u Root MySQL
mysql> UPDATE user SET Password=password (' NewPassword ') where user= ' root ';
mysql> FLUSH privileges;
Mysql> quit

#/etc/init.d/mysql Restart
# mysql-uroot-p
Enter Password: < Enter the new password newpassword>

Mysql>


Method Two:
Use the username and password provided directly in the [client] section of the/etc/mysql/debian.cnf file:
# mysql-udebian-sys-maint-p
Enter Password: < Enter the password for [client] section >
mysql> UPDATE user SET Password=password (' NewPassword ') where user= ' root ';
mysql> FLUSH privileges;
Mysql> quit

# mysql-uroot-p
Enter Password: < Enter the new password newpassword>

Mysql>


Method Three:

# mysql-uroot-p
Enter Password: < Enter the password provided in the [Client] section of/ETC/MYSQL/DEBIAN.CNF file >
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.