Update mariadb.md

This commit is contained in:
Super User
2024-03-20 19:35:53 +03:00
parent f9ff367e84
commit c0607402c8

View File

@@ -6,3 +6,15 @@
CREATE DATABASE dbn CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'usr'@'localhost' IDENTIFIED BY 'pwd'; GRANT ALL PRIVILEGES ON dbn.* TO usr@localhost;
```
## Create dump by table
```bash
for tab in `echo "SHOW TABLES" | mysql dbName | grep -v Tables_in_`; do
mysqldump --extended-insert=FALSE dbName "$tab" > "dbName-$tab-`date +%Y-%m-%d`.sql"
done
```
## Append field in table
```sql
ALTER TABLE existsTableName ADD COLUMN `newFieldName` varchar(64) NOT NULL DEFAULT '';
```