Manage Mysql Database with command line Print

  • 0

Create Database with command line

mysql -u root -p
mysql> CREATE DATABASE databasename;
mysql> GRANT ALL ON databasename.*
mysql> TO ‘username'@'localhost' IDENTIFIED BY ‘password';
mysql> flush privileges;

 

Create Mysql root pass:

$ mysqladmin -u root password NEWPASSWORD

 

Backup Mysql Database

mysqldump -u root -p databasename > databasebackup.sql

 

Backup Mysql Database with compress

$ mysqldump -u [username] -p[pass] [databasename] | gzip -9 > [backupfile.sql.gz]

 

Restore Mysql database

$ mysql -u root -p databasename < databasebackup.sql


Was this answer helpful?

« Back