mysqldump

mysqldump without database name

我们两清 提交于 2019-12-02 00:24:05
Is it possible to dump data in xml format without the database name in the output? If I dump output like this with the --xml option: $>mysqldump --xml my_database_name my_table > my_table.xml Then my output is something like <?xml version="1.0"?> <mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <database name="my_database_name"> ... You can see the database name in the output which I do not want. Is there an option to prevent that? I don't think there is such option for the mysqldump command. After generating the XML file, you can always use a script to get rid off the

第10周重点

和自甴很熟 提交于 2019-12-01 23:53:51
11.25 事物隔离级别 事物日志redo undo 事物锁 begin; update 事物日志性能优化 innodb_flush_log_at_trx_commit=0|1|2|3 innodb事务日志相关配置; show variables like '%innodb_log%'; 通用日志 通用日志:记录对数据库的通用操作,包括错误的SQL语句 通用日志可以保存在:file(默认值)或 table 通用日志相关设置 general_log=ON|OFF general_log_file=HOSTNAME.log log_output=TABLE|FILE|NONE 慢查询(重点) slow_query_log=on|off show profile for query 2; long_query_time=N; set global log_queries_not_using_indexes=ON; 二进制日志(重点) 记录导致数据改变或潜在导致数据改变的SQL语句 记录已提交的日志 不依赖于存储引擎类型 功能:通过“重放”日志文件中的事件来生成数据副本 注意:建议二进制日志和数据文件分开存放 二进制日志记录三种格式; 基于“语句”记录:statement,记录语句,默认模式 基于“行”记录:row,记录数据,日志量较大 (可恢复数据) 混合模式:mixed,

python subprocess and mysqldump

浪尽此生 提交于 2019-12-01 23:37:33
I know parts of this question have been asked before, but I have some related questions. I'm trying to execute mysqldump -u uname -ppassword --add-drop-database --databases databaseName | gzip > fileName I'm potentially dumping a very large (200GB?) db. Is that in itself a dumb thing to do? I then want to send the zipped file over the network for storage, delete the local dump, and purge a couple of tables. Anyway, I was using subprocess like this, because there doesn't seem to be a way to execute the entire original call without subprocess considering | to be a table name.: from subprocess

Import MySQL dump file into MSSQL

半世苍凉 提交于 2019-12-01 22:28:44
问题 Browsermob / Neustar produces a MySQLdump file that you can use to query load test data without incurring cloud hours (which are naturally billable). The dump file is a standard dump file, and although I understand that mysqldump has a compatible=mssql option, I am obviously not in a position to run that myself. Looking at the contents of the file (which is extremely large) using a text editor seems to show a series of SQL statements ending in a massive bulk insert. I tried to open the file

mysqldump中文乱码问题

本小妞迷上赌 提交于 2019-12-01 22:21:58
如果MySQL服务器上的字符集是 latin1 或者其他的的,mysqldump 出来的中文都是乱码!一个简单的办法是加上默认字符集选项,如: mysqldump [-h 127.0.0.1 -P 3307 ] -u username --default-character-set=gbk -p databasename > dumpfile.sql, --default-character-set 知道数据内容是中文时可以指定为 gbk,这样即使数据库本身设置字符集为 latin1 出来的文件中文也能正常! 来源: oschina 链接: https://my.oschina.net/u/220228/blog/141063

mysqldump备份mysql数据库脚本

偶尔善良 提交于 2019-12-01 21:49:59
可定义为定时任务,于凌晨2点执行。 中小型数据库采用全库全备方式,然后删除10天前的备份。 对于体积超过100G的还可以更改为增量备份脚本,节省空间。 #!/bin/bash #全库全备方式,一般在从机上执行,适用于小中型mysql数据库 #删除10天以前备份 #时间:2017.09.10 source /etc/profile #加载系统环境变量 source ~/.bash_profile #加载用户环境变量 user="root" #改成自己的数据 password="123456" #改成自己的数据 host="localhost" port="3306" db=("test") #需备份的数据库,请自行修改 #备份时加锁方式,MyISAM为锁表--lock-all-tables,InnoDB为锁行--single-transaction lock="--single-transaction" mysql_path="/usr/local/mysql" backup_path="${mysql_path}/backup" date=$(date +%Y-%m-%d_%H-%M-%S) day=10 backup_log="${mysql_path}/backup.log" #建立备份目录 if [ ! -e $backup_path ];then mkdir -p

mysql-mysqldump

白昼怎懂夜的黑 提交于 2019-12-01 21:49:23
备份(导出)所有数据库的数据和结构(注意:这种方式备份,还原时,无需先创建数据库,可直接导入) mysqldump -u root -p 'password' --all-databases > all.sql 备份指定数据库(db1和db2) mysqldump -u root -p 'password' ---databases db1 db2 > db1-db2.sql 恢复(导入)所有库 mysql -u root -p 'password' < all.sql 导入某个库(只导入db1这个数据库,db2不导入) mysql -u root -p 'password' db1 < db1-db2.sql 来源: https://www.cnblogs.com/kylingx/p/11717817.html

Import MySQL dump file into MSSQL

心不动则不痛 提交于 2019-12-01 19:39:56
Browsermob / Neustar produces a MySQLdump file that you can use to query load test data without incurring cloud hours (which are naturally billable). The dump file is a standard dump file, and although I understand that mysqldump has a compatible=mssql option , I am obviously not in a position to run that myself. Looking at the contents of the file (which is extremely large) using a text editor seems to show a series of SQL statements ending in a massive bulk insert. I tried to open the file in Microsoft SQL Management Studio but it crashed (known bug) because the file was too large. So, does

mysql的全量备份与增量备份

早过忘川 提交于 2019-12-01 19:17:18
mysql的全量备份与增量备份 全量备份:可以使用mysqldump直接备份整个库或者是备份其中某一个库或者一个库中的某个表。 备份所有数据库: [root@my ~]# mysqldump -uroot -p123456 --all-databases >/opt/all.sql mysqldump: [Warning] Using a password on the command line interface can be insecure. 备份单个数据库的所有表: [root@my ~]# mysqldump -uroot -p123456 --databases test>/opt/test.sql mysqldump: [Warning] Using a password on the command line interface can be insecure. 备份数据库中的单个表的结构: [root@my ~]# mysqldump -uroot -p123456 -d test userinfo >/opt/test_userinfo_jiegou.sql mysqldump: [Warning] Using a password on the command line interface can be insecure. 备份数据库中的单个表的内容:

How can I copy a single row/record from one MySQL instance to another?

三世轮回 提交于 2019-12-01 18:09:53
I have two MySQL instances running with the same schema. One is in the cloud; one is on my local box. The local-box version needs a couple of test rows in its main table. Effectively I'd like to do something like a mysqldump or mysqlhotcopy of a single record on the production table, and then "restore" that record into the same table on the local instance. I don't want to copy the whole table. If there are rows on the local table, I want them left alone. I'm fine with the PK of the copied row changing. I don't care about foreign keys, if any. The table is big and complex enough that it's