mysqldump

巨杉学习笔记 | SequoiaDB MySQL导入导出工具使用实战

十年热恋 提交于 2019-11-28 05:21:31
本文来自社区用户投稿,感谢这位小伙伴的技术分享 巨杉数据库架构简介 巨杉数据库作为分布式数据库是计算和存储分离架构,由数据库实例层和存储引擎层组成的。存储引擎层负责数据库核心功能比如数据读写存储以及分布式事务管理。数据库实例层也就是这里的的SQL层负责把应用SQL请求处理后发存储引擎层处理,并且把存储引擎层响应结果反馈给应用层。支持结构化实例比如MySQL实例/PG实例/spark实例,也支持非结构化实例比如 Json实例/S3对象存储实例/PosixFs实例等等。这种架构支持的实例类型比较多,方便从传统数据库无缝迁移到巨杉数据库,减小了开发学习成本,之前也跟数据库圈同行交流,他们对架构也是十分认可。 这里的SQL层采用的是MySQL实例,存储引擎层是有三个数据节点和协调节点编目节点组成。其中数据节点就是用来存储数据的,协调节点不存储数据,是用来把MySQL的请求进行路由分发到数据库节点。编目节点用来存储集群的系统信息比如用户信息/分区信息等等。这里用一个容器来模拟一个物理机或云虚拟机,这里设置的是MySQL实例在一个容器里,编目和节点和协调节点放在了一个容器,三个数据节点分别放在一个容器,三个数据节点构成了三个数据组,每个数据组三个副本。Web应用的海量数据是通过分片切分的方式分散给不同的数据节点,像这里的数据ABC通过分片打散到三台机器。

mysqldump备份总结

落花浮王杯 提交于 2019-11-28 05:16:47
常用的备份参数 -A 备份全库 -B 备某一个数据库下的所有表 -R, --routines 备份存储过程和函数数据 --triggers 备份触发器数据 --master-data={1|2} 告诉你备份后时刻的binlog位置 如果等于1,则将其打印为CHANGE MASTER命令; 如果等于2,那么该命令将以注释符号为前缀。 --single-transaction 对innodb引擎进行热备 -F, --flush-logs 刷新binlog日志 -x, --lock-all-tables 锁定所有数据库的所有表。这是通过在整个转储期间采用全局读锁来实现的。 -l, --lock-tables 锁定所有表以供读取 -d 仅表结构 -t 仅数据 --compact 减少无用数据输出(调试) 1. 全库备份 mysqldump -h 127.0.0.1 -u user -p pwd --all-databases > db_all.sql 2. 来源: https://www.cnblogs.com/root0/p/11393649.html

Free space in MySQL after deleting tables & columns?

。_饼干妹妹 提交于 2019-11-28 04:42:42
问题 I have a database of around 20GB. I need to delete 5 tables & drop a few columns in some other 3 tables. Dropping 5 tables with free some 3 GB and dropping columns in other tables should free another 8GB. How do I reclaim this space from MySQL. I've read dumping the database and restoring it back as one of the solution but I'm not really sure how that works, I am not even sure if this only works for deleting the entire database or just parts of it? Please suggest how to go about this. THanks.

Enable binary mode while restoring a Database from an SQL dump

荒凉一梦 提交于 2019-11-28 04:37:15
I am extremely new to MySQL and am running it on Windows. I am trying to restore a Database from a dumpfile in MySQL, but I get the following error: $ >mysql -u root -p -h localhost -D database -o < dump.sql ERROR: ASCII '\0' appeared in the statement, but this is not allowed unless option --binary-mode is enabled and mysql is run in non-interactive mode. Set --binary-mode to 1 if ASCII '\0' is expected. Query: 'SQLite format 3'. I have tried putting --binary-mode in the ini file but it still gives the same error. What should I do? Please help. UPDATE As suggested by Nick in his comment I

Minimum GRANTs needed by mysqldump for dumping a full schema? (TRIGGERs are missing!!)

荒凉一梦 提交于 2019-11-28 03:32:01
I have a MySQL user called dump with the following perms: GRANT USAGE ON *.* TO 'dump'@'%' IDENTIFIED BY ... GRANT SELECT, LOCK TABLES ON `mysql`.* TO 'dump'@'%' GRANT SELECT, LOCK TABLES ON `myschema`.* TO 'dump'@'%' I want to dump all data (included triggers and procedures) using the dump user. I call mysqldump in the following way: mysqldump -u dump -p --routines --triggers --quote-names --opt \ --add-drop-database --databases myschema > myschema.sql Everything is OK with the dumped file except for the triggers, they are missing !! The triggers are dumped correctly if I try mysqldump with

I want to copy table contained from one database and insert onto another database table

时间秒杀一切 提交于 2019-11-28 02:47:28
I want to copy a table's schema as well as the data within that table to another database table in another database on a live server. How could I do this? If you want to copy a table from one Database to another database , You can simply do as below. CREATE TABLE db2.table LIKE db1.table; INSERT INTO db2.table SELECT * FROM db1.table; or just CREATE TABLE db2.table SELECT * FROM db1.table in MySQL 5 CREATE TABLE db2.table_new AS SELECT * FROM db1.table_old If you just want Structure to be copied simply use CREATE TABLE Db_Name.table1 LIKE DbName.table2; Ps > that will not copy schema and data

Mysqldump only tables with certain prefix / Mysqldump wildcards?

心不动则不痛 提交于 2019-11-28 02:43:48
I have this huge, messy database I am cleaning up. It houses 500+ tables, which is the result of combining Magento Enterprise with Joomla in one single DB. To make things worse, there is a set of 70+ Joomla tables that are not in use at all. These are all prefixed with bak_ . Just deleting these bak_ tables will be easy, but I want to 'bak' them up first (see what I did there?). In my mind I can picture a command like this: mysqldump -u username -p mydatabase bak_* But this doesn't work. What would be the best way to do this? Thanks! EDIT: Yes, I could explicitly list the 70 tables to include,

how to mysqldump remote db from local machine

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 02:37:38
I need to do a mysqldump of a database on a remote server, but the server does not have mysqldump installed. I would like to use the mysqldump on my machine to connect to the remote database and do the dump on my machine. I have tried to create an ssh tunnel and then do the dump, but this does not seem to work. I tried: ssh -f -L3310:remote.server:3306 user@remote.server -N The tunnel is created with success. If I do telnet localhost 3310 I get some blurb which shows the correct server mysql version. However, doing the following seems to try to connect locally mysqldump -P 3310 -h localhost -u

mysql 数据库导出与导入

纵然是瞬间 提交于 2019-11-28 01:33:53
1、数据库导出         语句:mysqldump -u用戶名 -p密码 -d 数据库名 表名 > 脚本名;     1、导出整个数据库结构和数据       mysqldump -h localhost -uroot -p123456 database > dump.sql     2、导出单个数据表结构和数据       mysqldump -h localhost -uroot -p123456 database table > dump.sql     3、 导出整个数据库结构(不包含数据)       mysqldump -h localhost -uroot -p123456 -d database > dump.sql     4、导出单个数据表结构(不包含数据)       mysqldump -h localhost -uroot -p123456 -d database table > dump.sql     5、导出多个库 mysqldump --default-character-set=utf8 -h127.0.0.1 -uroot -p123456 -B database1 database2 >/db/doll.sql 2、数据库导入      1、首先建空数据库       mysql>create database dbname ;    

mysql数据库导入与导出

痴心易碎 提交于 2019-11-28 01:33:41
导出 导出数据和表结构:   mysqldump -u用户名 -p 数据库名 > 数据库名.sql   mysqldump -uroot -p dbname > dbname .sql //之后输入密码 只导出表结构   mysqldump -u用户名 -p -d 数据库名 > 数据库名.sql //之后输入密码   mysqldump -uroot -p -d dbname > dbname .sql 导入 1、首先建空数据库     mysql>create database abc ; 2、导入数据库   方法一:   (1)选择数据库     mysql>use database-n ame; //创建的库名   (2)设置数据库编码     mysql>set names utf8;   (3)导入数据(注意sql文件的路径)     mysql>source /usr/bin/user .sql;   方法二:     mysql -u用户名 -p 数据库名 < 数据库名.sql     mysqldump -uroot -p dbname > dbname .sql 来源: https://www.cnblogs.com/jing99/p/10550339.html