Mysql remote connection is acceptable. Local Connection reports an error

Source: Internet
Author: User
Use the MySQLdb library of python to connect to the local mysql database. The following error is returned: Fileusrlibpython2.7dist-packagesMySQLdb _ init __. py, line81, inConnectreturnConnection (* args, ** kwargs) Fileusrlibpython2.7dist-packagesMySQLdbconnections. py, line187

Use the MySQLdb library of python to connect to the local mysql database. The following error occurs: 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

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

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.