MySQL failed to log on to server error method summary

Source: Internet
Author: User

Tip: #2000 cannot log on to the MySQL server

Today with this machine installed a phpmyadmin, version 3.4.8, want to use it to connect a intranet server MySQL, and then modify phpMyAdmin configuration file config.inc.php, add the following code:

The code is as follows Copy Code

$i + +;
$cfg [' Servers '] [$i] [' auth_type '] = ' cookie ';
$cfg [' Servers '] [$i] [' host '] = ' 192.168.8.14 ';
$cfg [' Servers '] [$i] [' user '] = ' kkapp ';
$cfg [' Servers '] [$i] [' connect_type '] = ' TCP ';
$cfg [' Servers '] [$i] [' compress '] = false;
$cfg [' Servers '] [$i] [' allownopassword '] = false;

Save Open Browser login, prompt: #2000 Unable to login to MySQL server
Check IP, username, password no problem found
Use native MySQL client connection to log in normally, indicating network access, database access rights are no problem
SSH login to server open MySQL profile found one line of code available:
Old_passwords=1
Note, save, restart MySQL service, or not even

Ask Google, finally found the problem, originally from the "PHP 5.3.3, no longer support the use of old password to connect the database, at this time you can still use the MySQL client command to log in, log in after use"
This machine is installed in PHP 5.3.10, will cause the above problems

Solution:

The code is as follows Copy Code

mysql> update ' MySQL '. ' User ' SET ' Password ' = Password ("Hu Jintao") WHERE ' user ' = "Kkapp";

mysql> flush Privileges;

Pay attention to Old_passwords=1

This line should be commented out


Please set the username and password according to your database!


phpMyAdmin #2002 Error

#2002 cannot log on to the MySQL server

Copy the config.sample.inc.php into config.inc.php
This error indicates that no connection to the database has occurred. modifying config.inc.php files

The code is as follows

The code is as follows Copy Code
$cfg[' Servers ' [$i] [' host '] = ' localhost ';
Change to $cfg[' Servers ' [$i] [' host '] = ' 127.0.0.1 ';

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


#2003 cannot log on to the MySQL server

Said, I was in accordance with the following methods to solve, for reference only:

First step

Delete the My.ini below c:windowns (you can change it to a different name first.)

Second Step

Open the corresponding installation directory Mysqlbinwinmysqladmin.exe enter the username and password (you can also ignore this step)

The third step in DOS, into the MySQL bin directory.

Example: installation directory for D-disk Pc_webservermysqlbin

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

D://First switch to D disk

D:>CD Pc_webservermysqlbin//through the CD directory into the bin

Then enter the Mysqld-nt-remove removal service
then enter Mysqld-nt-install

Fourth step to restart the MySQL service

#1045 cannot log on to the MySQL server


The following error conditions may occur: phpMyAdmin: #1045 cannot log on to the MySQL server. Access denied for user ' root ' @ ' localhost ' (using Password:yes)

Problem reason: This may be due to the previous setting of the MySQL password did not succeed, so we use the set of MySQL root password can not log on to the server.

Workaround: At this point, you can try to log in to the database using the MySQL default root account's null password.

If you log in with a blank password, it appears: The null password login is disabled (see allow blank password) error. To modify the/phpmyadmin/libraries/config.default.php file, locate the following two lines

$cfg [' Servers '] [$i] [' nopassword '] = false;
$cfg [' Servers '] [$i] [' allownopassword '] = false;

Change the two false to true and set the $cfg [' Servers '] [$i] [' password '] = '; By setting the configuration file, phpMyAdmin will allow an empty password to log on to the MySQL database.

If you re logged in as a blank password phpMyAdmin sometimes still unable to log in, please clear the cookie or close the original phpMyAdmin login window and use the blank password to log on again.

If this time still show empty password login is prohibited, try to enter a few characters as a password to see whether the landing success.

After landing the MySQL server, the MySQL password will be modified in phpMyAdmin as soon as possible. or modify the MySQL password on the SSH client: cd/usr/local/mysql/bin

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

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

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.