Mysql

From SUNY Potsdam ACM
Revision as of 16:16, 5 March 2012 by Anthony Clark (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

<-- Back


Template for Posting

Go to the bottom of the postings, and paste this snippet and edit to your liking.


== My Posting ==
Description

<syntaxhighlight lang="sql">

   //Your code here

</syntaxhighlight>


Adding A User

To avoid flipping through pages of documentation, this is a shortcut to adding a user to a MySQL db. First, you must create a database. What this does is creates a use that has COMPLETE permissions on a specific Database.

--Anthony Clark

 GRANT ALL PRIVILEGES 
 ON my_database.* 
 TO 'my_user'@'localhost'
 IDENTIFIED BY 'my_password' 
 WITH GRANT OPTION;


Backup/Restore a Database

At a shell...

USER is usually 'root'

# Backup
mysqldump -u USER -p DATABASENAME > dumpfilename.sql
 
# Restore
mysql -u USER -p DATABASENAME < dumpfilename.sql
Personal tools