用戶端不能串連mysql的問題

來源:互聯網
上載者:User

標籤:修改   直接   查詢   word   主機   sel   min   檔案中   com   

文中的mysql是安裝在Linux虛擬機器中的,用戶端是在物理主機上的dbeaver
有道雲筆記直接粘貼過來的,格式太亂,建議查看這個有道雲筆記的連結

確儲存在可任意地方連結的使用者

在Linux中使用以下sql查詢

SELECT host, user FROM mysql.user; 

查詢結果如下

+-----------+------------------+| host       | user               |+-----------+------------------+| %             | admin            || 127.0.0.1 | admin            || localhost  | debian-sys-maint || localhost  | mysql.session    || localhost  | mysql.sys        || localhost  | root             |+-----------+------------------+

需要確儲存在如下的結果

+-----------+------------------+| host      | user             |+-----------+------------------+| %         | admin            |+-----------+------------------+

如果存在的話,則可以使用admin使用者進行登入(從任何地方);
如果不存在,那麼可以添加一條對應的使用者記錄具體的grant命令見官網文檔

mysql> grant all on yourdb.* to [email protected]‘%‘ identified by ‘yourpassword‘; //注意這裡的yourdb和yourpassword換成自己實際的值   
修改mysql設定檔中的bind-address

如果是使用虛擬機器的話,可能還需要查看下綁定的ip問題
使用如下命令

mysqld --verbose --help | grep bind-address

顯示結果如下

--bind-address=name IP address to bind to.bind-address                                                 0.0.0.0

需要確保的是,你的bind-address必須是0.0.0.0
The bind address have to be 0.0.0.0 (which means "every IP addresses") to work.

那麼如何去更改這個bind-address呢?
找到你的mysqld.cnf檔案,搜尋bind-address然後修改
一般Linux中,這個檔案在/etc/mysql/mysql.conf.d目錄下

參考

參考github的內容(見7樓)

用戶端不能串連mysql的問題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.