欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

mysql在线全备份和恢复_MySQL

程序员文章站 2024-01-27 09:59:52
...
bitsCN.com

mysql在线全备份和恢复

在线全备份:

  mysqldump -uroot -p --default-character-set=utf8 --opt --master-data=1 --single-transaction --flush-logs databasename > dabase_bak.sql

恢复:

  1)# mysql -uroot -p databasename source /root/dabase_bak.sql

大数据库的备份恢复:

 [root@ticket_backup ~]# vim /etc/my.cnf[mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockuser=mysql# Default to using old password format for compatibility with mysql 3.x# clients (those using the mysqlclient10 compatibility package).old_passwords=1# Disabling symbolic-links is recommended to prevent assorted security risks;# to do so, uncomment this line:# symbolic-links=0log-bin=mysql-binmax_allowed_packet = 32Mquery_cache_size = 32Mkey_buffer_size = 384Mtable_cache = 128K[mysqld_safe]log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid[mysqldump]max_allowed_packet = 32M

bitsCN.com
相关标签: mysql 在线