How to export mysql database in .sql extension using php code or in codeigniter -
how can download .sql file using php code or codeigniter code!
$this->dbutil->backup()
permits backup full database or individual tables. backup data can compressed in either zip or gzip format.
note: features available mysql databases. note: due limited execution time , memory available php, backing large databases may not possible. if database large might need backup directly sql server via command line, or have server admin if not have root privileges.
usage example
// load db utility class $this->load->dbutil(); // backup entire database , assign variable $backup =& $this->dbutil->backup(); // load file helper , write file server $this->load->helper('file'); write_file('/path/to/mybackup.sql', $backup); // load download helper , send file desktop $this->load->helper('download'); force_download('mybackup.sql', $backup);