mysql登录与备份
时间:2006-11-13 来源:qzc
备份mysql数据库
shell>mkdir DUMPDIR
shell>mysqldump --tab=DUMPDIR db_name
恢复
shell>mysqladmin create db_name
shell>mysql db_name < *.sql
shell>mysql db_name < *.txt
查看
mysqlshow db_name
或
mysql
show tables;
select * from tablename \G;
----------------------------------
直接复制本机数据库到远处
shell> mysqladmin -h 'other_hostname' create db_name
shell> mysqldump --opt db_name | mysql -h 'other_hostname' db_name
从远处复制数据库到本机
shell> mysqladmin create db_name
shell> mysqldump -h 'other_hostname' --opt --compress db_name | mysql db_name
shell>mkdir DUMPDIR
shell>mysqldump --tab=DUMPDIR db_name
恢复
shell>mysqladmin create db_name
shell>mysql db_name < *.sql
shell>mysql db_name < *.txt
查看
mysqlshow db_name
或
mysql
show tables;
select * from tablename \G;
----------------------------------
直接复制本机数据库到远处
shell> mysqladmin -h 'other_hostname' create db_name
shell> mysqldump --opt db_name | mysql -h 'other_hostname' db_name
从远处复制数据库到本机
shell> mysqladmin create db_name
shell> mysqldump -h 'other_hostname' --opt --compress db_name | mysql db_name
相关阅读 更多 +