MySQL remote connection Yes, local connection error

Source: Internet
Author: User

Use Python's mysqldb library to connect to the local MySQL database with the following error:


File "/usr/lib/python2.7/dist-packages/mysqldb/__init__.py", line Bayi, 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)")



Workaround:

Add ' root ' @ ' ***-vuldb.local ' access rights

The authorized root user has all of the TestDB databases permissions (all permissions for a database):

Mysql>grant all privileges in testdb.* to [e-mail protected]***-vuldb.localhost identified by ' 1234 ';

Mysql>flush privileges;//Refresh System Permissions Table

Format: Grant permissions on database. * To User name @ login host identified by "password";


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

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.