Service – MySQL

  • Install
sudo apt install mysql-server
  • Set root password
mysql -u root
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
  • Create database and user
mysql -u root -p

CREATE DATABASE database1;

GRANT ALL PRIVILEGES ON database1.* TO 'yourusername'@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
  • Dump (export)
mysqldump --routines -u root -p database1 > fulldump.sql
  • Restore (import)
cat fulldump.sql | mysql -u root -p database1

Tags: mysql