mysql 遠端連線可以,本地串連報錯,mysql本地串連

來源:互聯網
上載者:User

mysql 遠端連線可以,本地串連報錯,mysql本地串連

使用python的MySQLdb庫串連本地的mysql資料庫,報錯如下:


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)")



解決方案:

添加'root'@'***-vuldb.local'的存取權限

          授權root使用者擁有testDB資料庫的所有許可權(某個資料庫的所有許可權):

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

   mysql>flush privileges;//重新整理系統許可權表

  格式:grant 許可權 on 資料庫.* to 使用者名稱@登入主機 identified by "密碼"; 


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


mysql資料庫設定了遠端連線,本地就不可以再串連了?目前本地串連一直連不上,問怎解決,

遠程能串連的話,本地一定是能串連的,你現在說“不能串連”了,我估計可能是密碼錯誤,你看看結果,同一個使用者遠程和本地的密碼是不同的。

如果我猜中了,你用遠端連線設定一下本機使用者的密碼,或者刪除本機使用者密碼,既可解決問題。
 
mysql 本地可以串連 不可以遠端連線

確認你的mysql服務已經開啟;
確認你的mysql的連接埠配置正確;
確認你的遠程許可權配置正確;
如果還是連不上,看看是什麼串連錯誤,貼個圖!

 

相關文章

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.