Mysql remote connection is acceptable. Local Connection reports an error. mysql local connection

Source: Internet
Author: User

Mysql remote connection is acceptable. Local Connection reports an error. mysql local connection

Use the MySQLdb library of python to connect to the local mysql database. The error is as follows:


File "/usr/lib/python2.7/dist-packages/MySQLdb/_ init _. py", line 81, in Connect
Return Connection (* args, ** kwargs)
File "/usr/lib/python2.7/dist-packages/MySQLdb/connections. py", line 187, in _ init __
Super (Connection, self). _ init _ (* args, ** kwargs2)
_ Mysql_exceptions.OperationalError: (1045, "Access denied for user 'root' @ '***-vuldb. local' (using password: YES )")



Solution:

Add the 'root' @ '***-vuldb. local' access permission

Authorized root usersAll testDB DatabasePermissions (all permissions of a database ):

Mysql> grant all privileges on testDB. * to root @ ***-vuldb. localhost identified by '123 ';

Mysql> flush privileges; // refresh the system permission list

Format: grant permission on database. * to username @ login host identified by "password ";


Reference: http://www.cnblogs.com/fly1988happy/archive/2011/12/15/2288554.html


If a remote connection is set for the mysql database, the local database cannot be connected again? Currently, the local connection cannot be connected. How can this problem be solved,

If the remote connection is available, the local connection will be available. If you say "No connection" now, it may be a wrong password. Check the result, the remote and local passwords of the same user are different.

If I guess, you can use a remote connection to set the password of a local user or delete the password of a local user to solve the problem.
 
Mysql can be connected locally, but cannot be remotely connected.

Make sure that your mysql service is enabled;
Make sure that your mysql port is correctly configured;
Make sure that your remote permissions are correctly configured;
If you still cannot connect, see what is the connection error and paste a picture!


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.