MySQL Basics
Creating a new MySQL Database on Debian
- Login via SSH
- Run:
mysql -u root[note: if you have changed and/or set the password, use the -p option at the end] - Run:
create databases DATABASE; - Run:
exit;
Creating a MySQL User and Attaching It to a Database on Debian
- Login via SSH
- Run:
mysql -u root[note: if you have changed and/or set the password, use the -p option at the end] - Run:
grant ALL on DATABASE.* to 'user'@'localhost' IDENTIFIED BY 'password'; - Run:
flush privileges; - Run:
exit;
Importing a MySQL Backup
- Login via SSH
- Run:
mysql -u root DATABASE < /home/path/to/backup.sql[note: if you have changed and/or set the password, use the -p option at the end after root]
Exporting a MySQL Backup
- Login via SSH
- Run:
mysql -u root DATABASE > /home/path/to/save.sql[note: if you have changed and/or set the password, use the -p option at the end after root]