Debian下MySQL安裝,DebianMySQL安裝

來源:互聯網
上載者:User

Debian下MySQL安裝,DebianMySQL安裝
在Debian下安裝MySQL,步驟如下:

  Debian: /# apt-get install mysql-server

  裝好之後要預設root是沒有密碼的,可以更改.

  Debian: /# mysqladmin -u root password $(yourpass)

  在/etc/mysql/my.conf裡面可以修改一些屬性。

  原來有這麼一行:bind-address = 127.0.0.1

  意思是限定只有本機才能訪問,願意是為了保證資料安全。現在想要使得遠端機器能夠訪問MySQL資料庫服務,就可以通過改bind-address來實現, 兩種方式:

  1. bind-address = 0.0.0.0

  2. 直接把bind-address這一行注釋掉

  這樣做完之後,執行以下命令:

  /etc/init.d/mysql stop
  /etc/init.d/mysql start

  也有的說/etc/init/d/mysql reload, 但是有時候好像會出奇怪的問題,用上面兩步比較好。Ossim官方網站上說改成 bind-address = *, 我試了,行不通,浪費我好多時間。

  這樣幾步做完之後,還賦予遠程機器存取權限:

  mysql > GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY 'root_password' WITH GRANT OPTION;

  上面這條命令的意思是允許任何IP地址(%是萬用字元)的電腦用root帳戶和密碼(root_password)來訪問這個MySQL Server。

  這下就好了。

相關文章

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.