What if garbled characters occur when importing mysql data? How to troubleshoot Mysql import garbled characters _ MySQL

Source: Internet
Author: User
Tags cpanel mysql import
What if garbled characters occur when importing mysql data? How does one use phpmyadmin to import Mysql databases?

Cause:Mysql database files containing Chinese characters are easily garbled when imported to mysql databases through command lines.

Solution:

  1. Open the SQL file and add the following content to the first line of the SQL file:
    /*! 40101 set names utf8 */;
  2. Save SQL file as UTF-8 NO BOM format
  3. Upload the SQL file over ftp and put it in the root directory.
  4. Go to your cPanel, see the cron jobs icon, click in, and select Advanced (Unix Style)
Because it only needs to be run once, Minute, Hour, Day, and Month are all filled in with the specific time to be run, leave the remaining two minutes (if the VM is not local, you can check the host time on FTP.) fill in the * number for Weekday. Enter the Command to be run, that is, the import Command:

Mysql-u username-p password [-h database host] database <Database Backup. SQL

Assume that the IP address of the remote host is 10.0.0.1, the user name is root, and the password is 123. Enter the following command:

Mysql-h10.0.0.1-uroot-p123
Note:

You do not need to add spaces to u and root. The same applies to others. For example, my settings are as follows:

Mysql-ucpanel123_cpuser-pcpanel-hlocalhost cpanel123_cp

Then, view the import information in phpMyAdmin. Importing SQL files in this way is very fast. I wish you success.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.