2015年6月13日 星期六

[第二章]在Ubuntu上執行.NET程式安裝Mono平台步驟-Mariadb建置篇


==================================================
MariaDB建置步驟:
==================================================

匯入金鑰

sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
將Mariadb加入source list

sudo apt-get install software-properties-common 
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db 
sudo add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/10.0/ubuntu trusty main'
看你目前使用的系統版本

lsb_release -a

用apt-get install 直接安裝

sudo apt-get update
sudo apt-get install mariadb-server
有興趣安裝Galera Cluster(DB叢集)請直接參考下面原文內容

更新內容請參考:https://mariadb.com/kb/en/mariadb/installing-mariadb-deb-files/



====================================================
設定步驟
====================================================

一、建立登入帳號:

以root身份登入

mysql -u root -p

看看目前的資料庫清單並建立資料庫

show databases;

create database [DB NAME]


建立登入帳號並給予只有該資料庫的所有權


create user "[USER_NAME]"@"localhost" identified by "password" ;

grant all privileges on [DB NAME].* to ""[USER_NAME]"@"localhost" ;

show grants for "[USER_NAME]"@""localhost" ;


==================================================
WEB AP 和 DB 不同台主機時
==================================================

WEB AP和DB不同台主機時,可以將localhost改為%

create user "[USER_NAME]"@"%" identified by "password" ;

grant all privileges on [DB NAME].* to ""[USER_NAME]"@"%" ;

show grants for "[USER_NAME]"@""%" ;


接著修改 my.cnf

sudo vim /etc/mysql/my.cnf

將bind-address 這一行#註解掉,或是指定成你AP的IP ADDRESS(較安全)




沒有留言:

張貼留言

熱門文章