Below is a list of very common MySQL/MariaDB commands that any developer should know by heart.
Export MySQL Database
mysqldump -u username -p database_name > dump.sql
Import MySQL Database
mysql -u username -p -h servername database-name < data.sql
Login MySQL Database
mysql -uusername -p
Create MySQL Users
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON database . tablename TO 'username'@'localhost'; // Note user can be assigned to all databases GRANT ALL PRIVILEGES ON * . * TO 'username'@'localhost';
Change MySQL User Password
ALTER USER 'user-name'@'localhost' IDENTIFIED BY 'NEW_USER_PASSWORD';
FLUSH PRIVILEGES;
Discover more from AJB Blog
Subscribe to get the latest posts sent to your email.