Export mysql db:
#mysqldump -u [USERNAME] -p [DBNAME] | gzip > [/path_to_file/DBNAME].sql.gz
or
#mysqldump -u [USERNAME] -p [DBNAME] > [/path_to_file/DBNAME].sql
#mysqldump -u [USERNAME] -p [DBNAME] > [/path_to_file/DBNAME].sql
#gzip -d [/path_to_file/DBNAME].sql.gz
Import mysql db:
# gunzip mysqldump.sql.gz
# mysql -u username -p -h localhost test-database < mysqldump.sql
password: _
Use mysql:
#mysql -u [USERNAME] -p# mysql -u username -p -h localhost test-database < mysqldump.sql
password: _
Use mysql:
SHOW DATABASES;
DROP DATABASE [DBNAME];
CREATE DATABASE [DBNAME];
USE [DBNAME];
SOURCE [/path_to_file/DBNAME].sql;
No comments:
Post a Comment