Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
mysql [2008/09/03 18:54]
a
mysql [2009/03/03 19:38]
greebo
Line 20: Line 20:
  
 GRANT ALL PRIVILEGES ON *.* TO myuser@localhost IDENTIFIED BY 'password' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON *.* TO myuser@localhost IDENTIFIED BY 'password' WITH GRANT OPTION;
 +
 +
 +==== MySQL: removing duplicate rows from a table ====
 +
 +First create a temporary table containing the cleaned-up data:
 +
 +   CREATE TABLE without_duplicates_temp SELECT * FROM original_table GROUP BY columns, that, must, be, unique;
 +
 +and then just delete the original and rename the temporary table:
 +
 +   DROP TABLE original_table;
 +   RENAME TABLE without_duplicates_temp TO original_table;
  
  
Line 74: Line 86:
 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. 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.+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/.mysql_history\\ 
 +$ ln -s /dev/null $HOME/.mysql_history\\ 
 +\\ 
 +</code>
mysql.txt · Last modified: 2012/10/15 11:58 by zagi
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 ipv6 ready