Latency & quot; -- default-character-setlatin1-uroot-ptest & quot;. $ this-& gt; SQL _handle-& gt; datab php call system in linux
Ask you a question
$ Cmd = "\"". $ basedir. "bin \ mysqldump.exe \" -- default-character-set = latin1-uroot-ptest ". $ this-> SQL _handle-> database. "> ". $ doc_root. "\ test. SQL ";
$ Stat =-1;
System ($ cmd, & $ stat );
This code correctly exports the database in windows.
I have never used linux. how can I modify it in linux?
------ Solution --------------------
-- Default-character-set = latin1-u root-p test parameter name and parameter must be left blank
". $ Doc_root." \ test. SQL "path separator is/
------ Solution --------------------
This is a simple script for your reference.
#! /Bin/sh
# File:/home/mysql/backup. sh
# Database info
DB_NAME = "test"
DB_USER = "username"
DB_PASS = "password"
# Others vars
BIN_DIR = "/usr/local/mysql/bin"
BCK_DIR = "/home/mysql/backup"
DATE = 'date % F'
# TODO
$ BIN_DIR/mysqldump-opt-u $ DB_USER-p $ DB_PASS $ DB_NAME | gzip> $ BCK_DIR/db_1_date.gz
------ Solution --------------------
Exec for linux
Exec ("mysqldump-uroot-p database table>/www/.../SQL. SQL ");
------ Solution --------------------
/Usr/local/bin/mysqldump
No. exe
------ Solution --------------------
You are advised to switch to the apache/nginx user and execute the mysqldump command to confirm that it is not a permission issue.
------ Solution --------------------
/Usr/local/bin/mysqldump-uusername-ppwd dbname>/usr/local/www/data/test. SQL
Check whether the file/usr/local/bin/mysqldump is available.
Var_dump (system ("ls/usr/local/bin'
Modify/usr/local/www/data/test/permission to allow all users to write
I have always done this directly on the local terminal. I have never used php, so I can only give you this advice.