Ubuntu server安裝MySQL並配置遠端連線

來源:互聯網
上載者:User

標籤:serve   conf   ide   insert   option   denied   local   grant   設定   

1.  在Ubuntu server 安裝MySQL(過程中注意記住設定的密碼)

Sudo apt-get install mysql

Sudo apt-get install mysql-server

Sudo apt-get install mysql-client

備忘:此處遇到MySQL無法安裝的問題,提示dpkg:error processing package open-vm-tools(--configure)錯誤,解決方案是清除open-vm-tools之後重新安裝,sudo apt-get purge open-vm-tools, sudo apt-get install open-vm-tools.

2. 配置MySQL串連賬戶

         進入MySQL環境(mysql –u root –p)

         User mysql

         添加賬戶

(insert into mysql.user(Host,User,Password) values (“localhost”,”test”,password(“pass”));)

localhost指的本地,如果需要遠端連線,host可設定為”%”

備忘:在使用使用者進入MySQL環境時,遇到提示access denied問題,解決方案是更新mysql.user表中的authentication_string欄位,update mysql.user set authentication_string=password(‘pass’) where user=’test’ and Host=’localhost’

3. 對使用者進行授權

         命令:grant all privileges on databasename.tablename to ‘test’ @’localhost’ identified by ‘pass’ with grant option;

         databasename - 資料庫名,tablename-表名,如果要授予該使用者對所有資料庫和表的相應操作許可權則可用*表示,如*.*

         @後指代主機,需要全部則添加@’%’

4. 遠程使用sqlyog串連,連接埠預設3306

 

 

備忘:此處遇到串連提示1045的錯誤,解決方式是要對mysql.user表中對應的使用者,host設定為串連用ip,並設定authentication_string 和 對此使用者進行授權

Ubuntu server安裝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.