Manage Mysql Database with command line

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

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

find large file

find / -type f -size +100000000c -ls This will list all file located at "/" that...

Installing DBD::mysql from source

wget tar xvzf DBI-1.56.tar.gz cd...

Can I increase my VPS plan without upgrade my package?

No. The only way you increase your RAM is to upgrade the currect package to a higher package. We...

Hardening Server included

  LSM (Linux Socket Monitoring) installed and configured - Function is to monitor ANY...

Where is the datacenter VPS located?

Windows VPS is located at Colo4Dallas Taxes US BlueSquare UK Linux VPS is...

Powered by WHMCompleteSolution