Mysql
mysql -u username -h localhost -p
/* Show database */
show databases;
/* Select table */
mysql> use nibashportal;
/* Show table */
mysql> show tables;
mysql> desc wp_users;
/* Query */
mysql> select * from wp_users;
mysql> exit;
/*
Copying database on different server but having the same name.
Backup from source DB
*/
mysqldump --host [hostname] -u [username] -p --databases [dbname] > backup.sql
/* Restore bdd */
/*
--databases will make sure to add "USE [dbname]" in export so it you may not required to choose database while restoring.
Restore on destination db
*/
mysql --host [destinationhostname] -u [username] -p < backup.sql
/* Copying database on probably same DB server but with a different name. */
mysqldump --host [hostname] -u [username] -p [dbname] > backup.sql
/*
Note: No --databases option which will make sure it WON'T add "USE [dbname]" in export.
Restore on destination db
*/
mysql --host [destinationhostname] -u [username] -p [dbname2] < backup.sql
mysql -u lpgprodadmin -p