Difference between revisions of "SQL database"
From aquarium-doc
Jump to navigationJump to search
| Line 18: | Line 18: | ||
* Before restoring, create the database <code>aquarium</code> on the new device (log in with <code>sudo mysql -u root</code> and execute <code>create database aquarium;</code>) | * Before restoring, create the database <code>aquarium</code> on the new device (log in with <code>sudo mysql -u root</code> and execute <code>create database aquarium;</code>) | ||
* Restoring data from backup works with <code>sudo mysql -u root aquarium < name_of_backup.sql</code> | * Restoring data from backup works with <code>sudo mysql -u root aquarium < name_of_backup.sql</code> | ||
== Create user == | |||
Create user "aquarium" with matching password when restoring on a new device: | |||
* log in with <code>sudo mysql -u root</code> | |||
* execute <code>create user aquarium identified by 'password';</code> | |||
* execute <code>grant all privileges on aquarium.* to aquarium with grant option;</code> | |||
== Maintaining the database == | == Maintaining the database == | ||
| Line 24: | Line 29: | ||
Installation is done with the following steps: | Installation is done with the following steps: | ||
* <code>sudo apt install phpmyadmin</code> | * <code>sudo apt install phpmyadmin</code> | ||
Choose the Apache web server for configuration. This will automatically trigger the installation of Apache. | * Choose the Apache web server for configuration. This will automatically trigger the installation of Apache. | ||
== Structure of database == | == Structure of database == | ||
The database contains the following tables: | The database contains the following tables: | ||
Latest revision as of 14:29, 24 March 2023
Aquarium Control uses MariaDB.
Installation
Use the following commands to install MariaDB:
sudo apt-get updatesudo apt-get upgradesudo apt install mariadb-serversudo apt-get install libmariadb-devsudo apt-get install libmariadb-dev-compatsudo apt-get install libgsl-dev
The commands are also inside the libinstall script inside the repository of aquarium-ctrl.
Backup
Manual backup works as following:
- Export of database with
sudo mysqldump -u root aquarium > name_of_backup.sql - Transfer of data to alternative storage
- Before restoring, create the database
aquariumon the new device (log in withsudo mysql -u rootand executecreate database aquarium;) - Restoring data from backup works with
sudo mysql -u root aquarium < name_of_backup.sql
Create user
Create user "aquarium" with matching password when restoring on a new device:
- log in with
sudo mysql -u root - execute
create user aquarium identified by 'password'; - execute
grant all privileges on aquarium.* to aquarium with grant option;
Maintaining the database
Use phpmyadmin to administrate user rights. Installation is done with the following steps:
sudo apt install phpmyadmin- Choose the Apache web server for configuration. This will automatically trigger the installation of Apache.
Structure of database
The database contains the following tables: