For more information about how to convert data from MySQL4.1 to MySQL4.1, encoding is supported. Therefore, 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-d
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
First Reader Network reference
The code is as follows
Copy Code
CONVERT (expr USING transcoding_name)
In MySQL, transcoding names are the same as the corresponding character set names.
Examples:
The code is as follows
Copy Code
SELECT CONVERT (_latin1 ' Müller ' USING UTF8);INSERT into utf8table
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
MySQL built-in functions are very important functions. We can use MySQL built-in functions to convert strings to dates. The following describes this method for your reference.
Use str_to_date) in mysql to convert a string to a date.
MySQ
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 |
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
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
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
conversion to date function: FROM_UNIXTIME ()
General format: select FROM_UNIXTIME (1156219870 );
2. convert a date to a UNIX timestamp using the function: UNIX_TIMESTAMP ()
General format: Select UNIX_TIMESTAMP ('2017-11-04 12:23:00 ′);
Example: mysql queries the number of records on the current day:
$ SQL = "select * from message Where DATE_FORMAT (FROM_UNIXTIME (chattime), '% Y-% m-% d') = DATE_FOR
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
I worked in a small company, daily work is to maintain the normal operation of the site, rewrite the site of small bugs, as well as with the boss of each "epiphany" creativity, today the boss needs to move the original ASP's website to the newly purchased PHP system, resulting in 2 problems
1. Convert the MSSQL database to MySQL
2. Re-write the contents of the fields in some tables into the New system tabl
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
Tags: MySQL SQL Server conversionFor project reasons, the MySQL database needs to be converted to MMSQL2008. Read the online tutorial, downloaded a lot of software to try, and finally converted to success. Write an article to help someone with the need.1, first have to have a MMSQL2008 database, and MySQL database.2. Then download the official Microsoft Conversio
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
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
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.