neodjandre Posted November 13, 2012 Share Posted November 13, 2012 Hello the following script imports a mySQL database in wordpress. However, i need to add the parameter --default_character_set utf8 Could you please help me out with the correct syntax? <?php //ENTER THE RELEVANT INFO BELOW $mysqlDatabaseName ='db123456789'; $mysqlUserName ='dbo123456789'; $mysqlPassword ='yourPassword'; $mysqlHostName ='db1234.perfora.net'; $mysqlImportFilename ='yourMysqlBackupFile.sql'; //DONT EDIT BELOW THIS LINE //Export the database and output the status to the page $command='mysql -h' .$mysqlHostName .' -u' .$mysqlUserName .' -p' .$mysqlPassword .' ' .$mysqlDatabaseName .' < ' .$mysqlImportFilename; exec($command,$output=array(),$worked); switch($worked){ case 0: echo 'Import file <b>' .$mysqlImportFilename .'</b> successfully imported to database <b>' .$mysqlDatabaseName .'</b>'; break; case 1: echo 'There was an error during import. Please make sure the import file is saved in the same folder as this script and check your values:<br/><br/><table><tr><td>MySQL Database Name:</td><td><b>' .$mysqlDatabaseName .'</b></td></tr><tr><td>MySQL User Name:</td><td><b>' .$mysqlUserName .'</b></td></tr><tr><td>MySQL Password:</td><td><b>NOTSHOWN</b></td></tr><tr><td>MySQL Host Name:</td><td><b>' .$mysqlHostName .'</b></td></tr><tr><td>MySQL Import Filename:</td><td><b>' .$mysqlImportFilename .'</b></td></tr></table>'; break; } ?> Link to comment https://forums.phpfreaks.com/topic/270634-mysql-php-import-script/ Share on other sites More sharing options...
fenway Posted November 16, 2012 Share Posted November 16, 2012 http://dev.mysql.com/doc/refman/5.0/en/mysql-command-options.html#option_mysql_default-character-set Link to comment https://forums.phpfreaks.com/topic/270634-mysql-php-import-script/#findComment-1392829 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.