robsnider
7/17/2017 - 6:53 PM

MySQL database commands

MySQL database commands

#MySQL Socket# mysql_config --socket

#Export Database#

From https://www.digitalocean.com/community/tutorials/how-to-import-and-export-databases-and-reset-a-root-password-in-mysql

mysqldump -u [username] -p [database name] > [database name].sql

#Import Database#

From https://www.digitalocean.com/community/tutorials/how-to-import-and-export-databases-and-reset-a-root-password-in-mysql

mysql -u username -h localhost -p databasename < filename.sql

#Update url after migration# UPDATE wp_posts SET guid = REPLACE(guid, 'oldurl', 'newurl') WHERE INSTR(guid, 'oldurl') > 0;

#Turn off Validate Password Plugin# http://stackoverflow.com/questions/36301100/how-do-i-turn-off-the-mysql-password-validation#38538641

Login to the mysql server as root

mysql -h localhost -u root -p

Run the following sql command:

uninstall plugin validate_password;

to re-enable it again, use following command:

INSTALL PLUGIN validate_password SONAME 'validate_password.so';