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
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 |
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
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
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
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 ()
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
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
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
Access can only be used under Windows This deadly feature makes me sick and determined to convert access to MySQL, but I've found a lot of articles on the Internet that have no direct conversion. I heard that you can use ODBC to turn, just try it.
First installs the MYSQL,MYODBC, constructs a MySQL empty database,
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
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
These two days in the company's service-side project, found MySQL more practical 3 functions, here to share.1, Aes_encrypt function, the use of this function is to some of the high security requirements of the data using AES encryption, the syntax is:Aes_encrypt (Str,key), where the first parameter represents the data to encrypt, and the second parameter is the corresponding key.2, Aes_decrypt function, this function is a function corresponding to the
) +------------------------+| CAST (' 3.35 ' as signed) |+------------------------+| 3 |+------------------------+1 row in SetAs in the example above, the varchar is converted to int with cast (a as signed), where a is a varchar-type string.Example 4In SQL Server, the following code demonstrates the result of a DateTime variable that contains only a single date and a simple time when the date stores the hexadecimal store representation.DECLARE @dt datetime--Simple date set @
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.