MySQL Quick Reference
Web Development, mysql September 1st, 2008I use MySQL all the time when building websites. I have a self-built CMS and a number of clients all running off of the system. Here are a few SQL commands that I use regularly:
Dump databases
> mysqldump --quick -all-databases -uadmin -p > alldatabases.db
Dumps all of the databases to a single file. Along with regular server backups I use this to keep copies of everything for my own reference.
–quick == forces MySQL to retrieve and dump the tables a row at a time rather than buffering. Useful for large tables
–all-databases == self explanatory I hope
-uadmin == username admin
-p == ask for password. My installation needs the password to perform any actions
To dump a single database:
> mysqldump --quick -uadmin-p database_name > filename.db
I personally use .db at the end of my files, but they’re simply text files of INSERT instructions and can be named however you like. From a dumped database, you can import all of that content into a new database:
> mysql -uadmin -p database_name < filename.db
This will fail if for example, the keys for a table already exist in both the database and the import file.
Search and Replace
I find this really useful. To search and replace words across a table, in a particular field:
mysql> UPDATE table_name SET field_name=REPLACE(field_name_again,
'look for me','change to me) WHERE..
The WHERE part is optional. Leave out any WHERE filter if you want to apply to all records in the table.
More to come…
September 19th, 2008 at 10:12 pm
Hey there!
Is it possible to request Bible translations? In my studies I like to use the Today’s English Version (Good News), The New King James, New International Version, The Message and the Lamsa Translation. Thank you very much for making this program!
Regards,
Felmar Serreno
September 21st, 2008 at 10:10 am
Those translations are covered by copyright and as such are more difficult to obtain than translations freely available in the pubilc domain. In addition, the file format for the current version of Bible Reader Free is plain text, which the copyright holders would not allow for their versions.
I would love to have other translations available and this is part of the plan for the software. At a later stage I’ll be altering the file format to better protect the content, then I will approach some of the copyright holders to see if they will let me offer their versions