Mysql remote connection is acceptable. Local Connection reports an error
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