38 lines
623 B
Markdown
38 lines
623 B
Markdown
# Mariadb Memo
|
|
|
|
## Initialize Mariadb
|
|
|
|
Basic user and dir config, using:
|
|
|
|
```bash
|
|
mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
|
|
```
|
|
|
|
## Security Configuration
|
|
|
|
```bash
|
|
mysql_secure_installation
|
|
```
|
|
|
|
Mariadb can login as system user root without password. Usually root can only be allowed to login from localhost.
|
|
|
|
## Create Operation Users
|
|
|
|
Create a user with CRUD access:
|
|
|
|
```bash
|
|
create user demo_rw@'%' IDENTIFIED by 'your password';
|
|
```
|
|
|
|
Then grant access:
|
|
|
|
```bash
|
|
grant select, insert, update, delete on `demo`.* to 'demo_rw'@'%';
|
|
```
|
|
|
|
And refresh privilages:
|
|
|
|
```bash
|
|
flush privileges;
|
|
```
|