whattimeisitonthesun.com

... and other useful things

Category

mysql

Copy MySQL users from one server to another

Copy MySQL users from one server to another Copy MySQL users including db-rights: oldserver$ mysqldump mysql > mysql.sql newserver$ mysql mysql < mysql.sql newserver$ mysql ‘flush privileges;’ Remember to add -u $USER and -p$PASSWORD as required  

MySQL: Set field value based on timestamp

MySQL: Set field value based on timestamp UPDATE TABLE SET FIELD=”NEWVALUE” WHERE DATEFIELD < ‘2014-12-23 23:45:01‘;

Move WordPress site to new domain or new location

Move WordPress site to new domain or new location If you change the URL or link location of your WordPress site (e.g from www.olddomain.com to www.newdomain.com) or to another directory location (such as from www.domain.com to www.domain.com/blog), there are some… Continue Reading →

Restore MySQL db from backup .gz

Restore MySQL db from backup .gz zcat DATABASE.sql.gz |mysql -uUSER -pPASSWORD DATABASE

Set MySQL root password from init-file

Set MySQL root password from init-file Stop the MySQL server by sending a normal kill to the mysqld process Create a text file containing the following statements (replace “TheNewPassword” with the password that you want to use): UPDATE mysql.user SET… Continue Reading →

Reset MySQL root password

Reset MySQL root password Stop mysqld and restart it with the –skip-grant-tables option. This enables anyone to connect without a password and with all privileges. Because this is insecure, you might want to use –skip-grant-tables in conjunction with –skip-networking to… Continue Reading →

Copy data from one table to another in MySQL

Copy data from one table to another in MySQL UPDATE table_to_be_updated INNER JOIN source_table ON (table_to_be_updated.field_to_match = source_table.field_to_match) SET table_to_be_updated.field_to_be_updated = source_table.source_field

Wordpress theme design by Anders NorenUp ↑