1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to mysql dump special characters?

Discussion in 'Site & Server Administration' started by postcd, Aug 3, 2017.

  1. #1
    Hello, currently i have FTP access to a web hosting account, i also have mysql credentials.
    My aim is to export mysql database so i am using php function:
    <?php exec('mysqldump --user=*** --password=*** --host=*** dbnamehere -r exp.sql'); ?>
    that does not create any file, but when used: > exp.sql
    it create file but with damaged special characters. By special characters i mean: ěščřžýáíé and similar. By damaged i mean replaced by ? or other strange chars.

    The resulting dump and the table with damaged chars contains among other:
    /*!40101 SET character_set_client = utf8 */;

    i tried to add this switch to mysqldump:

    but still damaged chars. which command to run please to have working dump?

    UPDATE: i see that the command mentioned above somehow worked and created file. Even the file had wrong characters in it, i downloaded it via web browser and imported other hosting account mysql via PHPMyAdmin (left encoding set to UTF-8 on PHPMyAdmin Import tab. and it imported it successfully and seems no problem with chatractes. So this topic seems SOLVED, unless someone have an advice for future dumps.
    Last edited: Aug 3, 2017
    postcd, Aug 3, 2017 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Likes Received:
    Best Answers:
    Trophy Points:
    I'm guessing the file itself doesn't have wrong characters, but whatever you're using to view the file isn't using UTF-8 as default character set, hence the ? replacement. Or your environment isn't set up using UTF-8.
    PoPSiCLe, Aug 5, 2017 IP
    postcd likes this.