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!