---
# System prepended metadata

title: CentOS MySQL
tags: [Linux]

---

# CentOS MySQL 

## 開啟 VMware 外部連接權限
CentOS 預設安裝的MySQL是MariaDB，安裝後的預設port是3306，須自己在MySQL內建立可以通過外部ip連線的帳號及在防火牆開port

**MySQL 語法：**
``` cmd
// 建立帳號
CREATE USER '{username}'@'{remoteIP}' IDENTIFIED BY '{password}';

// 增加權限
GRANT ALL PRIVILEGES ON {database name}.{table name} TO '{username}'@'{remoteIP}';
```
***{remoteIP}*** 預設是 localhost，如果要不限ip就用 '%'


**Firewalld 語法：**
https://www.jinnsblog.com/2018/08/centos-firewalld-guide.html
http://note.drx.tw/2017/09/the-firewalld-on-centos-7.html

###### tags: `Linux`