Sunday, January 30, 2011

MySQL Basics

Creating a new MySQL Database on Debian

* Login via SSH
* Run: mysql -u root [note: if you have changed and/or set the password, use the -p option at the end]
* Run: create databases DATABASE;
* Run: exit;

Creating a MySQL User and Attaching It to a Database on Debian

* Login via SSH
* Run: mysql -u root [note: if you have changed and/or set the password, use the -p option at the end]
* Run: grant ALL on DATABASE.* to 'user'@'localhost' IDENTIFIED BY 'password';
* Run: flush privileges;
* Run: exit;

Importing a MySQL Backup

* Login via SSH
* Run: mysql -u root DATABASE < /home/path/to/backup.sql [note: if you have changed and/or set the password, use the -p option at the end after root] Exporting a MySQL Backup * Login via SSH * Run: mysql -u root DATABASE > /home/path/to/save.sql [note: if you have changed and/or set the password, use the -p option at the end after root]

No comments:

Post a Comment

Confused? Feel free to ask

Your feedback is always appreciated. I will try to reply to your queries as soon as time allows.

Note:
Please do not spam Spam comments will be deleted immediately upon my review.