Summary of errors caused by MySQL failure to log on to the server

Source: Internet
Author: User

This article provides a summary of the various Error Methods and solutions that MySQL cannot log on to the mysql server, including: #2000 errors, #2002 errors, #2003 errors, and #1045 errors.

Tip: #2000 unable to log on to the MySQL server

Today, I installed phpMyAdmin on my local machine, version 3.4.8. To use phpMyAdmin to connect to Mysql on an intranet server, modify the phpMyAdmin configuration file config. inc. php and add the following code:

The Code is as follows: Copy code

$ I ++;
$ Cfg ['servers'] [$ I] ['auth _ type'] = 'cooker ';
$ Cfg ['servers'] [$ I] ['host'] = '2017. 168.8.14 ';
$ Cfg ['servers'] [$ I] ['user'] = 'kapp ';
$ Cfg ['servers'] [$ I] ['connect _ type'] = 'tcp ';
$ Cfg ['servers'] [$ I] ['compus'] = false;
$ Cfg ['servers'] [$ I] ['allownopassword'] = false;

Save and open the browser login, prompt: #2000 unable to log on to MySQL Server
Check the IP address, user name, and password.
The local mysql client can be used for normal login, indicating that network access and database access permissions are normal.
Log on to the server via SSH and open the Mysql configuration file to find a line of code:
Old_passwords = 1
Note: Save, restart the Mysql service, or the connection fails.

Ask Google and finally find the problem. It turns out that from "php 5.3.3, you no longer support using the old password to connect to the database. At this time, you can still use the mysql client command to log on, use"
The above problem occurs only when PHP 5.3.10 is installed on the local machine.

Solution:

The Code is as follows: Copy code

Mysql> update 'mysql'. 'user' SET 'Password' = Password ("*****") WHERE 'user' = "kkapp ";

Mysql> flush privileges;

Note: old_passwords = 1

Comment out this line

 
Please set according to your database username and password!


Phpmyadmin #2002 Error

Solution #2002 unable to log on to the MySQL server

Copy config. sample. inc. php to config. inc. php.
This error indicates that the database is not connected. Modify the config. inc. php file

The Code is as follows:

The Code is as follows: Copy code
Set $ cfg ['servers'] [$ I] ['host'] = 'localhost ';
Change to $ cfg ['servers'] [$ I] ['host'] = '2017. 0.0.1 ';

Or
Modify php. ini: mysql. default_socket =/tmp/mysql. sock Technology


#2003 unable to log on to the MySQL server

I have solved the problem as follows for your reference only:

Step 1

Delete my. ini under c: windowns (you can change it to another name)

Step 2

Open mysqlbinwinmysqladmin.exe in the installation directory and enter the user name and password (skip this step)

Step 3: Go to the mysql bin directory under dos.

For example, the installation directory is PC_webservermysqlbin of disk D.

Start-run-cmd> _ bH,/d'

D: // switch to disk d first

D:> cd PC_webservermysqlbin // enter the bin directory through the cd directory

Enter mysqld-nt-remove to delete the service.
Enter mysqld-nt-install

Step 4 restart the mysql Service

#1045 unable to log on to the MySQL server


The following error may occur: phpmyadmin: #1045 cannot log on to the MySQL server. Access denied for user 'root' @ 'localhost' (using password: YES)

Cause: This may be because the mysql password was not successfully set, so we cannot log on to the server using the configured mysql root Password.

Solution: log on to the database with an empty password of the default root account of mysql.

If you log on with an empty password, the following error occurs: Empty Password Logon is forbidden (see allow empty password. Modify the/phpmyadmin/libraries/config. default. php file and find the following two lines:

$ Cfg ['servers'] [$ I] ['nopassword'] = false;
$ Cfg ['servers'] [$ I] ['allownopassword'] = false;

Change the two false values to true, and set $ cfg ['servers'] [$ I] ['Password'] = ''; after setting the configuration file, phpmyadmin allows logging on to the mysql database with an empty password.

If you attempt to log on to phpmyadmin again with an empty password, you may not be able to log on again. Clear the cookie or close the original phpmyadmin logon window and use the empty password to log on again.

If the empty password is still disabled at this time, try to enter a few characters as the password to check whether the login is successful.

After logging on to the mysql server, change the mysql password in phpmyadmin as soon as possible. Or modify the mysql password in the SSH client: cd/usr/local/mysql/bin.

Then run the command:./mysqladmin-u root-p passwordhttp: // laser-mall.com/passwd.

Finally, delete all users except root in the mysql user table.

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.