Installing MySQL
- sudo apt install mysql-server
- sudo mysql
change “root” and “password” to whatever you want
- ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘password’;
- exit
- sudo mysql_secure_installation
MySQL: Creating Users and Databases
- sudo mysql -u root -p
Change “example_database”, “example_user” and “password” to whatever you want:
- CREATE DATABASE example_database;
- CREATE USER ‘example_user’@’%’ IDENTIFIED BY ‘password’;
OPTIONAL – Change password of users:
- ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘password’;
- GRANT ALL ON example_database.* TO ‘example_user’@’%’;
- exit
Delete a Database
- DROP DATABASE database_name;