1
0
mirror of https://git.envs.net/envs/help.git synced 2024-06-14 21:16:38 +00:00
help/docs/database.md

53 lines
1.7 KiB
Markdown
Raw Normal View History

2019-11-14 13:12:12 +00:00
# # user database
2019-10-12 18:18:28 +00:00
## sqlite
in the spirit of minimalism, the recommended database technology to use here is sqlite. sqlite db's exist as a single, atomic file, and are a good use for light applications, with low to medium concurrent loads.<br>
it also allows for greater flexibility, and segregation for your application's data: you can create as many sqlite databases as you need.
- [documentation](https://sqlite.org/docs.html)
- [sqlite cli](https://sqlite.org/cli.html)
## mysql
- [documentation](https://dev.mysql.com/doc/mysql-getting-started/en/)
on `localhost` port `3306`
- database name: `username`
- database user: `username`
- password: *see you welcome email*
connecting to mysql:<br />
&nbsp;&nbsp;`mysql -u username -p`
2020-01-15 11:07:04 +00:00
use database:<br />
&nbsp;&nbsp;`use username`
change your password:<br />
*do not store password change to history:*<br />
*`export MYSQL_HISTFILE=/dev/null`*
2020-01-15 11:07:04 +00:00
&nbsp;&nbsp;`SET PASSWORD = PASSWORD('your-password-here');`
2019-10-12 18:18:28 +00:00
### database backup & restore
simple backup:<br />
&nbsp;&nbsp;`mysqldump "$USER" -p > ~/backup/dump_"$USER".sql`
and restore:<br />
&nbsp;&nbsp;`mysql -p -u "$USER" < ~/backup/dump_"$USER".sql`
you can also use our `envs_mysql.sh` - backup and restore script.<br />
the backup files will stored under `~/backup/`.
show `envs_mysql.sh -h` for more informations
```bash
2019-11-21 13:13:21 +00:00
usage: envs_mysql.sh
2019-10-12 18:18:28 +00:00
backup - backup your default user database
backup <db_name> - backup database
restore - restore your latest user database
restore <db_name> - restore database
```
with cron you can also do your backup regularly at a certain time.<br />
2019-10-30 19:53:10 +00:00
see [help -&gt; cron](https://help.envs.net/help/#croncrontab) for a example.