linux(Debian)下安裝與MySql的安裝、配置及使用

來源:互聯網
上載者:User

標籤:

參考資料:http://www.cnblogs.com/xusir/p/3334217.html

以下是簡要記錄。

一、安裝

安裝:apt-get install mysql-server mysql-client

MySQL安裝完成後不象SQL Server預設安裝在一個目錄,它的資料庫檔案、設定檔和命令檔案分別在不同的目錄,瞭解這些目錄非常重要,尤其對於Linux的初學者,因為 Linux本身的目錄結構就比較複雜,如果搞不清楚MySQL的安裝目錄那就無從談起深入學習。

  1、資料庫目錄
  /var/lib/mysql/

  2、設定檔
  /usr/share/mysql(mysql.server命令及設定檔)

  3、相關命令
  /usr/bin(mysqladmin mysqldump等命令)

  4、啟動指令碼
  /etc/rc.d/init.d/(啟動指令檔mysql的目錄)

二、登入

"mysql -u使用者名稱 -p密碼 [-h主機ip];"    或   "mysql -u使用者名稱 [-h主機ip] -p", 接著輸入密碼

三、啟動、停止、重啟等

開機檔案mysql在/etc/init.d目錄下,執行:/etc/init.d/mysql start|stop|restart|reload|force-reload|status

關閉/etc/init.d/mysql stop 或直接 mysqladmin -u使用者名稱 -p密碼 shutdown

四、修改密碼

mysqladmin -u使用者名稱 -p原密碼 pssqord 新密碼

五、常用操作

show databases;

use 資料庫名;

create/drop database 資料庫名;

 

show tables;

describe 表名;

create/drop table 表名;

 

其他基本SQL操作

六、增加使用者

grant select on 資料庫.* to 使用者名稱@登入主機 identified by "密碼" 

如:

grant select,insert,update,delete on *.* to [email protected]"%" Identified by "123"; 

grant select,insert,update,delete on aaa.* to [email protected] identified by "123";

 

linux(Debian)下安裝與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.