mysqldump

MysqlDump from Powershell and Windows encoding

若如初见. 提交于 2019-12-09 09:53:32
问题 I'm doing an export from command line on ms-dos with mysqldump: & mysqldump -u root -p --default-character-set=utf8 -W -B dbname > C:\mysql_backup.sql My database/tables are encoded with UTF-8 and I specify the same encoding when I did the dump. But when I open the file with Notepad++ or Scite I see an encoding of UTF-16 (UCS-2). If I don't convert the file with iconv to UTF-8 before running the import I got an error. It seems that MS-DOS / CMD.exe is redirecting by default with UTF-16. Can I

Copying a mysql database generates “ERROR: unknown command” when importing

旧巷老猫 提交于 2019-12-08 14:21:34
I'm on a japanese system using xampp. This is the line I use to dump my database. c:\xampp\mysql\bin>mysqldump.exe -uroot wp_newsja > dump.sql Then I create a database on another server. c:\xampp\mysql\bin>mysqladmin -uroot create db But when I try to execute the sql... c:\xampp\mysql\bin>mysql -uroot db < dump.sql ... I get the following error. ERROR at line 145: Unknown command '¥''. On a japanese computer windows path slashes / are represented with "¥". Which leads me to believe this is an utf8 issue. Maybe there is a way I can mysqldump with some utf8 flag? Thanks for any assistance! The

Mysql备份恢复方案解析

♀尐吖头ヾ 提交于 2019-12-08 13:11:34
1.全量备份和增量备份 1.1全量备份 就是对现有的数据进行全部备份,之前做的备份均可舍弃,以最新的全备为基点。 a.全备所有数据库 Innodb引擎: [root@leader mysql]#mysqldump -uroot -proot -F -A -B --events --single-transaction --master-data=1|gzip>/data/backup/mysql_backup_$(date +%F).sql.gz Myisam引擎: [root@leader mysql]#mysqldump -uroot -proot -F -A -B --events --lock-all-tables --master-data=1|gzip >/data/backup/mysql_backup_$(date +%F).sql.gz 参数说明: -F参数:刷新binlog -A参数:备份所有库 -B参数:备份数据的时候添加建库建表等语句 --events参数相当于-E:在输出中包含转储数据库的事件调度器事件 --master-data参数:如果参数值等于1,在备份文件中添加change master语句在主从同步change master的时候就不用制定binlog日志文件以及更新的位置,如果等于2则不会添加change master语句。 --single

mysqldump doing a partial backup - incomplete table dump

一曲冷凌霜 提交于 2019-12-08 10:04:29
I have a database of about 6GB in size and it has a table with 12.6 million rows. I tried to export the database into a SQL dump by: mysqldump -u root -p db_name > db_name.sql When the command finishes, the exported SQL dump file is just about 2GB and the primary table got exported only about 1 million rows. What could possibly be wrong? There is a 2GB filesize limit for some reason, the easiest way to get around this is using split : mysqldump ... | split -b 250m - filename.sql- You can also compress the files like this: mysqldump ... | gzip -9c | split -b 250m - filename.sql.gz- To restore

command restore mysql db backup in php

北慕城南 提交于 2019-12-08 08:32:22
问题 i'm having a problem when restoring the db file. Below is that script that I use to restore: <?php $dbhost = "localhost"; $dbuser = "root"; $dbpwd = ""; $dbname = "fhc_test"; $dumpfile = "backup/".$_GET['id'].".sql"; exec("C://xampp/mysql/bin/mysql -u $dbuser -p $dbpwd $dbname < $dumpfile"); ?> Below is the script that I use to do the backup: <?php $dbhost = "localhost"; $dbuser = "root"; $dbpwd = ""; $dbname = "fhc"; date_default_timezone_set("Asia/Singapore"); $dumpfile = "backup/". $dbname

MySQL Dump Limit? MySQL overall database size limit?

旧城冷巷雨未停 提交于 2019-12-08 06:20:28
问题 Client just had ~1000 rows of data (most recent, of course), just go missing in one of their tables. Doing some forensics, I found that the "last_updated_date" in all of their other rows of said table was also set to roughly the same time as the deletion occurred. This is not one of their larger tables. Some other oddities are that the mysqldumps for the last week are all exact same size -- 10375605093 Bytes. Previous dumps grew by about .5GB each. MySQL Dump command is standard: /path/to

MySQL数据库 (下)

不羁岁月 提交于 2019-12-08 05:18:29
MySQL数据库 (下) MySQL高级应用 一、 MySQL联结表 : 预备知识: 1、关系表:把信息分解成多个表, 一类数据 一个表, 各表 通过某些 共同的值相互关联 (所以才称为 关系数据库 )。 2、联结:联结是一种机制,用来在一条SELECT语句中关联表,因此称为联结。通过联结,一条SELECT语句可以联结多个表返回一组输出。 3、完全限定列名: 表名+ . +列名 。 4、笛卡儿积(叉联积):由没有联结条件表关系返回的结果为笛卡儿积,结果的行数是第一个表的行数乘以第二个表的行数。 5、表别名和列别名(SQL 一个别名只存在于查询期间。表别名只会在查询执行中使用。与列别名不同,表别名不返回MySQL客户端):SELECT 列名 AS 列别名 FROM 表名 AS 表别名 (Oracle中没有AS,别名设置不用AS,直接指定别名即可)   一、 INNER JOIN(内连接/等值连接)--获取两个表中字段匹配关系的记录; mysql> SELECT a.runoob_id, a.runoob_author, b.runoob_count FROM runoob_tbl a INNER JOIN tcount_tbl b ON a.runoob_author = b.runoob_author; mysql> SELECT a.runoob_id, a.runoob

mysqldump schema only, schema update without drop

流过昼夜 提交于 2019-12-07 11:41:01
问题 I'm looking at using the git pre-commit hook to export a MySQL db schema prior to commiting changes so that other developers can update their own databases with a SQL script from the git repo. By default a mysqldump (I'm using --no-data) will drop existing tables before rebuilding them which isn't what I'm after. I'm wondering if anyone knows of a way to do a mysqldump or similar to describe the db schemas with SQL to update tables if they exists instead of a drop and rebuild. I realize this

Exporting database through my java code

蓝咒 提交于 2019-12-07 09:30:15
问题 I want to export my MySQL database using my java code. But I have not found any way to do. What I want to do that there is a button in my app as "Export Database". When that button is clicked, my database should be exported to specified path. I have used the following code but it does'nt worked : Runtime runtime = Runtime.getRuntime(); runtime.exec("C:\\Program Files\\MySql\\MySql Server 5.5\\bin\\mysqldump -u root -p myDatabase> D:\\backup.sql"); How should I do this task. Thanks. 回答1: Two

why is the `tcgetattr` error seen when ssh is used for dumping the backup file on another server?

我的梦境 提交于 2019-12-07 03:11:43
问题 I want to dump a tables backup on another server and I am using ssh for doing it. when I run the below command, it gives an error but dump file is copied to destination. mysqldump -u username -ppassword dbname tablename | ssh -t -t servers_username@domain_name 'cat > /tmp/bckp.sql'; tcgetattr: Invalid argument If I press CTRL + c then it appends error message with Killed by signal 2. Why is this error? 回答1: I've seen this error when forcing pseudo-terminal allocation using ssh -t -t or ssh