Tag : mysql-2

MySQL – create user and grant all privileges

Create user with mysql command:


CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';

Add all privilleges to databases for user:


GRANT ALL ON *.* TO 'username'@'localhost';

MySQL – import / export database from / into file

Export database into a file with shell command:


mysqldump -u USERNAME -p PASSWORD database > filename.ext;

Import database from a file with shell command:


mysql -u USERNAME -p PASSWORD database < filename.ext;