php


Is it possible using PHP to backup SQL without dependecies? If not, which is the best?


After a huge MySQL blunder on a production server (my fault, and yes I have learned), I am now looking at creating a dump of the MySQL database before I do a critical operation (about 15 queries to the db, insert/update/selects). I know phpMyAdmin can 'dump' the database to SQL queries, but I think this may be a feature of it, not a feature of MySQL?
So, is there a way to do this using MySQL, and if not (which I suspect), what would be the best way to dump the db to a file on the server on command? Preferably as a tarball of the whole DB in ready to import SQL format.
Thank You!
You are looking for the mysqldump function, I believe:
mysqldump my_database > database.dump
MySQL dump will do it, and you can pipe it to gzip so it stores better:
mysqldump --opt -Q -h[server] -u[username] -p[password] [dbname] | gzip > [file].sql.gz
And to restore you unzip it and:
mysql -h[server] -u[username] -p[password] [dbname] < [file].sql
I've used this for a few years now, why re-create the wheel :)
http://worldcommunity.com/opensource
Another good route is to use something like sqlyog to automate backups. I run this on a local Windows machine I have to do backups of all my remote servers.

Related Links

Compare directory contents to database column in Joomla
How to access the html contents in the php code segment within the same php file?
How to change the index name of array
New line chr in twitter feed breaks JSONP
FFmpeg failed to transcode - Error while opening encoder for output stream
need ideas for remote authentication (Wordpress) [closed]
get parent array name after array_walk_recursive function
How To Insert From Data From PHP to MySQL DB
Form, receive variables on same php file [duplicate]
Arrays and nested foreach
Sidenavigation. Load everything with one request or splitted?
Display TinyMCE inputted text causing undisplayable characters
how to echo a node value (not atribute)
Cakephp Not validating data in Form
Regex Substring Negation
Selecting style attribute with REGEX in PHP

Categories

HOME
oracle
user-interface
firebase
memory
weblogic12c
compilation
loopbackjs
openlayers-3
iverilog
web2py
swift2
mosquitto
tweepy
driver
multi-step
user-defined-types
robolectric
yii2-basic-app
workday
sqlplus
stackexchange.redis
mime-types
channel
sybase-ase
pdf.js
crud
dnsmasq
memory-fences
bean-validation
transform
subclassing
formsauthenticationticket
cordys-opentext
love2d
variable-variables
ng-repeat
gitolite
ejml
robust
dagger
qvtkwidget
phppgadmin
visual-format-language
subforms
mura
algebra
oid
nclam
mathjs
nsrunloop
pyaudio
jsf-2.3
qpixmap
node-glob
gravatar
as3-api
seadragon
directx-9
mobilefirst-server
unidata
physicsjs
comctl32
rubber
image-rotation
smacss
zend-mail
mobile-country-code
oracle-adf-mobile
git-reset
prism.js
strdup
cloo
ctp
virtual-channel
node.js-stream
.net-remoting
eager-loading
contextswitchdeadlock
xcode4.5
getproperty
kaazing
hardcode
mkannotation
servercontrol
datacontracts
css-friendly
ccl
android-2.1-eclair
jdownloader
fuzzy-comparison
datagridcolumn
levels

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App