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

Re-ordering Strings in PHP
How to find parent array key in multidimensional array php
How to test file upload in Laravel 5.2
Yii2: REST API - 404 error
Docker-compose Nginx php-fpm file not found
PHP not throwing error if the class name is bad on Windows 10 and Vagrant [duplicate]
PHP static function as parameter with dependency injection
How do I paginate json data in php
How to assign a value to an associative array
php - PasswordHash check and login
Recreating XML feed with parent - child elements
Laravel 5.0 auth not working without reason
use function from index.php like this class->publicF->f()
Slicing from text file
select columns from multiple tables with join
PHP Read or Copy File from a Network Drive (Window)

Categories

HOME
qt
opengl
entity-framework
memory
mc
azure-functions
generics
windows-8.1
android-fragments
foaf
cdi
pyresttest
clickable-image
xbap
max-msp-jitter
temperature
tomcat8
gmp
cloudsim
clr
social-tables
akka-persistence
backtracking
device
mod-wsgi
plyr
spreadsheetgear
points
miniprofiler
bonita
matlab-app-designer
location-services
python-2.x
plantuml
cloudera-manager
autoencoder
amazon-kms
rails-postgresql
dreamfactory
ftp-server
cordys-opentext
identify
praat
vb.net-to-c#
contactless-smartcard
virtual-memory
photoswipe
redisson
pen
pecl
maatwebsite-excel
fuzzer
oci
eclemma
node.js-connect
currency-exchange-rates
miniconda
apache-commons-digester
directx-9
ora-04091
highest
netdatacontractserializer
css-paged-media
libz
compositetype
android-handler
org-babel
unidata
webproject
kotlin-android-extensions
html-escape-characters
lifetime
dnsjava
berkeley-db-xml
windows-messages
map
django-settings
jmenubar
non-ascii-characters
arel
donut-chart
server-name
nsfont
asio
kernel32
fragment-identifier
channelfactory
android-input-method
fgetc
service-factory

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App