Background: The dnname of a MySQL database in a system adopts the default Latin1 character set. During system upgrade, all data must be converted to UTF-8 format and the target database is newdbname (utf8 is used for database creation) Method 1: Step 1 run the command: mysqldump -- opt-hlocalhost-uroot-P *** -- default-character-set = lantin1 dbname>/usr/local/dbname. SQLStep 2 Change charset = Latin1 of the create table statement in the dbname. SQL f
Background: The dnname of a MySQL database in a system adopts the default Latin1 character set. During system upgrade, all data must be converted to UTF-8 format and the target database is newdbname (utf8 is used for database creation)
Method 1:
Step 1Execute the command line: mysqldump -- opt-hlocalhost-uroot-P *** -- default-character-set = lantin1 dbname>/usr/local/dbname. SQL
Step 2Change charset = Latin1 of the create table statement in the dbnam
MySQL4.1 supports encoding, so it is a little troublesome to convert old data. However, you only need to pay attention to the following:
1. dump the original data before conversion. Generally, the original data is encoded in gb2312 format. The dump command is as follows:
MySQLdump -u -p database –add-drop-table –extended-insert
-Add-drop-table is used to avoid table creation during import.-extended-insert is used to prevent an SQL sta
Find a good way to convert from SQLServer to Mysql database
Find a good way to convert from SQLServer to Mysql database
At the beginning of the year, I had been working on the migration of a website MSSQL2000-> MySQL5. Because different program systems were used, the main problem was data migration. Because the struct
This article describes how to convert xml and mysql data in php. the instance encapsulates a class file to convert XML and MySQL data, it has some reference value. if you need it, you can refer to the following example to describe how to convert xml and
MySQL turns timestamps into common time formatsIn MySQL, the storage type of a time field is int (11), and how to convert it into a character type, for example, to store 13270655222, needs to be converted to YYYY-MM-DD form.Use the From_unixtime function, as follows:From_unixtime (Unix_timestamp,format)Returns a String representing the Unix time token, formatted
pages. It takes a long time for the website ranking and indexing results to be restored, and there is a large amount of data in the original website, manual conversion is not realistic.
So now we need a transfer scheme to convert MSSQL into MYSQL. I have found a lot on the internet, either complicated or useless at all (I have chosen several simple methods to try it ), the following method is the simplest
Emeditor or iconv to convert the file encoding to UTF-8. Be sure not to use the Unicode signature(bom#", because mysql.exe does not recognize it. Replace gbk_bin in the file with utf8_general_ci, replace gbk with utf8, and add:
Set names utf8;
With BOM, MySQL does not recognize the following errors:
ERROR 1064 (42000) at line 1:You have an error in your SQL syntax; check the manua
CONVERT () provides a way to CONVERT data between different character sets. Syntax:
CONVERT (expr USING transcoding_name)
In MySQL, the conversion code name is the same as the corresponding Character Set Name.
Example:
Select convert (_ latin1 'müler' USING utf8 );
Inse
Convert () provides a way to convert data between different character sets. The syntax is:
CONVERT(expr USING transcoding_name)
In MySQL, the conversion code name is the same as the corresponding character set name.
Example:
SELECT CONVERT(_latin1'Müller' USING utf8); IN
Recently, the company asked a website to be revised and download the website programs and databases to programmers. The program file is very simple. Just download it by creating a compressed package. When I looked at the configuration file to view the database, I was dumpfounded. The database type was postgresql, and I had never heard of the Data Type before, let alone the operation. No way, you have to stick your head down. Baidu times to see how to export postgreSQL.
Export the database struct
is something. Because I want to explain in this post is the varchar sort problem. So no longer explain how I changed the field type, people are interested to search my previous log. (cheat Click) phenomenon Description: Below, I server_id order from the database inside, we look at the results after the sorting: select server_id from cardserver where game_id = 1 ORDER by server_id D ESC Limit 10;+-----------+| server_id |+-----------+| 8 | | 7 | | 6 | | 5 | | 4 | | 3 | | 2 | | 10 | | 1 |
Https://files.cnblogs.com/files/miantiaoandrew/mss2sql_v5-3.zip1. First download the tool, link above2. Extract it, run Mss2sql.exe3. Altogether two options, select the first item here, move directly to MySQL server4. Fill in the SQL Server link information, here directly using the "." (dot), to the local Windows login way to link, remote server to fill in the IP, user name, password it5. Fill in the MySQL
Programmers who have written PHP + MySQL know that there is a time difference. UNIX timestamps and formatting dates are two forms of time representation that we often deal with. The Unix timestamps are easy to store and process, but not intuitive, the date format is intuitive, but it is not as easy to process as the Unix timestamp, so sometimes it needs to be converted to each other. Below are several conversion methods for mutual conversion.I. Comple
Programmers who have written PHP + MySQL know that there is a time difference. UNIX timestamps and formatting dates are two forms of time representation that we often deal with. The Unix timestamps are easy to store and process, but not intuitive, the date format is intuitive, but it is not as easy to process as the Unix timestamp, so sometimes it needs to be converted to each other. Below are several conversion methods for mutual conversion.
I. Co
necessary to convert each other, the following gives the conversion of several different ways. One, complete in MySQL This way in the MySQL query statement conversion, the advantage is not to occupy PHP parser parsing time, fast, the disadvantage is only used in database query, there are limitations. 1. UNIX timestamp converted to date function: From_unixtime ()
If you can use SQL computing to return results during mysql query, you can use php to handle the returned results first. For example, you can convert the case sensitivity of fields, in general, how do you perform mysql query? If you can use SQL computing to return good results, you should first return the results and use php to handle them. For example, if you wa
When reading MySQL in C #, the following issues may occur if there is a field type of Date/datetime"Unable to convert MySQL date/time value to System.DateTime"Cause: It is possible that the value of the field (Date/datetime) defaults to the default value: 0000-00-00/0000-00-00 00:00:00, when such data is read out and converted into System.DateTime, there is a pro
Mysql to convert NULL data (mandatory), mysqlnull
Use mysql to query the database.Left joinSome associated fields areNULLTherefore, after obtaining the record set, you need to convert NULL data.
This article provides a way to directly execute the Conversion Processing during the query. The obtained record set does not
The MySQL character set processing method described below is to convert different MySQL character sets into a unified character set. This method is for your reference and may be helpful in learning the MySQL character set.
AfteranupgradetoMySQL4.1,thestatementfails:
mysq
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.