點選在我的部落格 xuxusheng.com 中檢視,有更好的排版哦~
一開始覺的 ubuntu 用的爽,apt+ppa 簡單又友善,用着用着又覺得 centos 好像在其他方面更爽一點,其實具體有啥差異自己也說不太上來,還是新手水準,慢慢熟練centos的使用。
mariadb
是由開源社群維護,拉出的一個
mysql
分支。目的在于避開甲骨文公司收購mysql後,潛在的閉源風險。
安裝 mariadb
sudo yum -vy install mariadb-server mariadb mariadb-devel
yum
會自動進行安裝,稍後會提示 Complete
管理 mariadb
systemctl enable mariadb # 設定成開機啟動
systemctl start mariadb # 啟動 mariadb
systemctl stop mariadb # 關閉 mariadb
systemctl restart mariadb # 重新開機 mariadb
預設使用
mysql -u root -p
即可進入資料庫界面。
配置 mariadb
mysql> grant all privileges on *.* to [email protected]'localhost' identified by 'passwd';
// 将預設的 root 使用者設定成 localhost,這樣就隻能從本機進行通路了。
// privileges 可以省略,*.* 表示所有資料庫的所有表
mysql> create user 'username'@'%' identified by 'passwd';
// 或者
mysql> grant all privileges on *.* to 'username'@'%' identified by 'passwd';
// 建立新使用者,% 表示比對所有的host
最後使用
flush privileges
指令重新整理生效。
Tips:
show grants for username
:檢視某個使用者的權限。