mysqldump

Import of 8GB mysql dump takes a long time

亡梦爱人 提交于 2019-12-03 11:24:09
I've got an 8GB MYSQL database dump of InnoDB tables created with mysqldump. I import the data with: mysql -uroot -p my_db < dump.sql An 5 GB dump of the DB was imported within an hour. The 8 GB dump takes 50 hour and counting. When I inspected the processlist with SHOW PROCESSLIST; Most of the time there was a single INSERT query visible with state "'freeing items" Is there a way, besides copying the raw files, to speed up the import process? The trick really, is to ensure that the biggest single table fits in the innodb buffer pool. If it does not, then inserts (and import of course) will be

Importing MySQL database from one server to another

空扰寡人 提交于 2019-12-03 11:11:52
I have got two dedicated servers with root access. Both are running Linux. I want to import database from Server1 to Server2. I have already created an empty database on Server2. I want to know Linux command through which I can import database directly? Is there such a feature? Can I use mysqldump? I want to avoid first taking database backup on server1, then moving that file to server2, and then importing that file. Can import be done directly using some command? Thanks If you want to avoid creating a file, transferring it, and loading it, you can just pipe mysqldump into either an mysql

数据库备份

末鹿安然 提交于 2019-12-03 11:02:55
直接上代码 public function dataBackup(){ $doc_root=$_SERVER['DOCUMENT_ROOT']; $file_path_name=$doc_root.'/sqlbackup';  //保存到的路径 $name='backup_'.date('YmdHis').".sql"; if(!file_exists($file_path_name)){mkdir($file_path_name,0777);} $mysqldump_url='G:\phpstudy\PHPTutorial\MySQL\bin\mysqldump.exe';//mysqldump.exe的绝对路径,安装mysql自带的有,可以搜索一下路径 $host='127.0.0.1';//数据库所在的服务器地址 $User='root';//数据库用户名 $Password='root';//数据库密码 $databaseName='kuer';//数据库名 $process=$mysqldump_url." -h".$host." -u".$User." -p".$Password." ".$databaseName." >".$file_path_name."/".$name; $er=system($process);//system()执行外部程序,并且显示输出

mysqldump实时增量备份

隐身守侯 提交于 2019-12-03 11:01:29
数据备份策略: ♣ 完全备份:备份所有数据 ♣ 增量备份:备份上次备份后,所有新产生的数据 ♣ 差异备份:备份完全备份后,所有新产生的数据 完全备份(mysqldump) # mkdir /mydata # mysqldump -uroot -p123456 -A > /mydata/alldb.sql (备份所有) # mysqldump -uroot -p123456 db2 > /mydata/db2.sql (备份db2库) # mysqldump -uroot -p123456 db2 t2 > /mydata/db2_t2.sql (备份db2库的t2表) # mysqldump -uroot -p123456 -B db3 db2 > /mydata/twodb.sql (备份 db3,db2库) 来源: https://www.cnblogs.com/jiang-bokeyuan/p/11792355.html

Ignore 'views' in mysql db backup using mysqldump

喜夏-厌秋 提交于 2019-12-03 10:42:18
I need to ignore all view in my database and take backup using mysqldump. Currently i am using below option. --ignore-table=view1 --ignore-table=view2 --ignore-table=view3 Is there any way to take backup omitting all views without specifying all 'view' names.? If the MySQL user you're using doesn't have access to read Views, then just putting an -f flag on the mysqldump command will skip them. Unfortunately, it prints a warning which might be annoying, but it will otherwise complete the dump. Try this query: SELECT CONCAT('mysqldump -u username -ppassword -h host [some options here] `',`TABLE

mysql面试题

会有一股神秘感。 提交于 2019-12-03 10:38:32
1、MySQL的复制原理以及流程 基本原理流程,3个线程以及之间的关联; 2、MySQL中myisam与innodb的区别,至少5点 (1)、问5点不同; (2)、innodb引擎的4大特性 (3)、2者selectcount(*)哪个更快,为什么 3、MySQL中varchar与char的区别以及varchar(50)中的50代表的涵义 (1)、varchar与char的区别 (2)、varchar(50)中50的涵义 (3)、int(20)中20的涵义 (4)、mysql为什么这么设计 4、innodb的事务与日志的实现方式 (1)、有多少种日志; (2)、事物的4种隔离级别 (3)、事务是如何通过日志来实现的,说得越深入越好。 5、问了MySQL binlog的几种日志录入格式以及区别 (1)、binlog的日志格式的种类和分别 (2)、适用场景; (3)、结合第一个问题,每一种日志格式在复制中的优劣。 6、问了下MySQL数据库cpu飙升到500%的话他怎么处理? (1)、没有经验的,可以不问; (2)、有经验的,问他们的处理思路。 7、sql优化 (1)、explain出来的各种item的意义; (2)、profile的意义以及使用场景; 8、备份计划,mysqldump以及xtranbackup的实现原理 (1)、备份计划; (2)、备份恢复时间; (3)

Mysqldump command not found

南笙酒味 提交于 2019-12-03 10:21:39
I want to export my database and i am using this code: mysqldump -p -u markazo_b markazo_b > /tmp/file.sql But SSH show this error: -bash: mysqldump: command not found How i fix this problem? The solution I found is adding MySql's installation directory to PATH Steps: 1. Find where MySql is installed 2. Add the bin directory of MySql installation to PATH (In the terminal), locate mysqldump export PATH=$PATH:MY_SQL_INSTALLATION_DIRECTORY/bin MY_SQL_INSTALLATION_DIRECTORY is the directory you found by locate mysqldump : Example export PATH=$PATH:/usr/local/mysql-5.6.23-osx10.8-x86_64/bin You

day37 学习小结

不羁岁月 提交于 2019-12-03 10:15:15
目录 一、事物 1. 事物的使用方法 2. 事物的特性 3. 储存引擎 二、视图 1. 增加视图 2. 删除视图 三、触发器 1. 增加触发器 2. 查看触发器 3. 删除触发器 四、存储 过程 1. 创建过程 2. 使用这个过程 3. 删除过程 五、函数 六、备份 1. 用法 2. 重新导入 一、事物 通俗的说,事物指一组操作,要么都执行成功,要么都执行失败。 1. 事物的使用方法 start transaction; sql语句 commit(提交)/rollback(回滚到事物开始的地方) 2. 事物的特性 原子性(Atomicity):原子意为最小的粒子,即不能再分的事务,要么全部执行,要么全部取消。 一致性(Consistency):指事务发生前和发生后,数据的总额依然匹配。 隔离性(Isolation):简单点说,某个事务的操作对其他事务是不可见的。 持久性(Durability):当事务完成后,其影响应该保留下来,不能撤销,只能通过“补偿性事务”来抵消之前的错误。 3. 储存引擎 Innodb:支持事务,支持行锁 MyISAM:不支持事务,只支持表锁 二、视图 1. 增加视图 create view 视图名 as SQL语句; 2. 删除视图 drop view 视图名; 三、触发器 当两个操作同时发生时,其中一个操作可以出发另一个操作,如果该操作一致不完成

Can MySQL reliably restore backups that contain views or not?

社会主义新天地 提交于 2019-12-03 09:50:00
问题 Environment: Ubuntu 11.10, MySQL 5.1.58 I have a small database with views. When I try to dump and restore, I get ERROR 1356 (HY000) at line 1693: View 'curation2.condition_reference_qrm_v' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them However, I can connect to the partially-restored database and create the view myself. Therefore, I suspect that the error message results from an issue unrelated to the view itself (but rather how it

Can&#039;t get mysqldump to connect to local mysql instance (error 2003 / 10061)

匿名 (未验证) 提交于 2019-12-03 08:46:08
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've got mysql 5.1 on a windows xp machine. It's listening on port 3308. I'm trying to use mysqldump: > mysqldump -u root -pmypassword dbname > out.sql Getting an error: mysqldump: Got error: 2003: Can't connect to MySQL server on 'localhost' (10061) when trying to connect Not sure what the problem is, looking at --help dumps variables and shows port=3308 as I set in the mysql installation (instead of default 3306). I don't think there's anything different with my installation. I also tried explicitly setting the port # on the command line