Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
mysql [2008/03/14 12:55] greebo |
mysql [2009/03/29 21:27] a + Converting Character Sets |
||
---|---|---|---|
Line 20: | Line 20: | ||
GRANT ALL PRIVILEGES ON *.* TO myuser@localhost IDENTIFIED BY ' | GRANT ALL PRIVILEGES ON *.* TO myuser@localhost IDENTIFIED BY ' | ||
+ | |||
+ | |||
+ | ==== MySQL: removing duplicate rows from a table ==== | ||
+ | |||
+ | First create a temporary table containing the cleaned-up data: | ||
+ | |||
+ | | ||
+ | |||
+ | and then just delete the original and rename the temporary table: | ||
+ | |||
+ | DROP TABLE original_table; | ||
+ | | ||
Line 28: | Line 40: | ||
mysql --user=username --password=password --execute=" | mysql --user=username --password=password --execute=" | ||
mysql --user=username --password=password --default-character-set=utf8 dbname < dump.sql | mysql --user=username --password=password --default-character-set=utf8 dbname < dump.sql | ||
+ | |||
+ | |||
Line 52: | Line 66: | ||
# cat data| mysql --default-character-set=latin2 | # cat data| mysql --default-character-set=latin2 | ||
- | === InnoDB === | + | ===== Aternative (new) way Converting Character Sets ===== |
+ | |||
+ | wget http:// | ||
+ | |||
+ | It will be added to [[https:// | ||
+ | |||
+ | ===== InnoDB | ||
[mysqld] | [mysqld] | ||
default-storage-engine=innodb | default-storage-engine=innodb | ||
Line 60: | Line 80: | ||
- | To convert tables | + | ==== Convert MyISAM tables to InnoDB ==== |
- | | + | [[http:// |
+ | |||
+ | If you want to convert a MyISAM | ||
+ | |||
+ | ALTER TABLE tablename ORDER BY ' | ||
+ | |||
+ | This will pre-arrange the table so that it can be converted quickly without a lot of re-arranging required in MySQL. Then, simply change the table engine: | ||
+ | |||
+ | ALTER TABLE tablename ENGINE | ||
+ | |||
+ | If your table is large, then it may take a while to convert it over. There will probably be a fair amount of CPU usage and disk I/O in the process. | ||
+ | |||
+ | These statements are also safe in replicated environments. When you issue this statement to the master, it will begin the conversion process. Once it is complete on the master, the statement will roll down to the slaves, and they will begin the conversion as well. Keep in mind, however, that this can greatly reduce the performance of your configuration in the process.\\ | ||
+ | |||
+ | \\ | ||
+ | <code bash> | ||
+ | $ rm $HOME/ | ||
+ | $ ln -s /dev/null $HOME/ | ||
+ | \\ | ||
+ | </ |