mysqldump

mysqldump from a query

这一生的挚爱 提交于 2019-12-03 19:53:40
问题 How can I make a mysql dump for table from a query? I need something like this.. mysqldump -uroot -pxxxx mydb "select * from table where name='1';" > /tmp/a Thanks. 回答1: mysqldump has a --where parameter: Manual Dump only rows selected by the given WHERE condition. Quotes around the condition are mandatory if it contains spaces or other characters that are special to your command interpreter. Examples: --where="user='jimf'" -w"userid>1" -w"userid<1" I don't know what they use, but phpMyAdmin

Too many open files error on Ubuntu 8.04

女生的网名这么多〃 提交于 2019-12-03 19:30:46
问题 mysqldump: Couldn't execute 'show fields from `tablename`': Out of resources when opening file './databasename/tablename#P#p125.MYD' (Errcode: 24) (23) on checking the error 24 on the shell it says >>perror 24 OS error code 24: Too many open files how do I solve this? 回答1: At first, to identify the certain user or group limits you have to do the following: root@ubuntu:~# sudo -u mysql bash mysql@ubuntu:~$ ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling

MYSQL import: Cannot get geometry object from data you send to the GEOMETRY field

好久不见. 提交于 2019-12-03 17:36:42
问题 I have recently upgraded to MySQL 5.7 and was trying to run a replication from 5.6 master. However the replication fails with the following error: Error 'Cannot get geometry object from data you send to the GEOMETRY field' on query. Turns out it also happens when I try to import data from the mysqldump. Table structure is as follows: CREATE TABLE `locations` ( `location_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `country_id` int(10) unsigned NOT NULL, `name` varchar(100) CHARACTER SET utf8

What is sql-dump for?

吃可爱长大的小学妹 提交于 2019-12-03 17:13:00
问题 I know that a SQL dump is a series of insert SQL statements which reflect all the records inside the database. But what is it used for? Why should we dump the database records? Does every database support a dumping function? 回答1: Somewhat strangely, this is actually the usual way to back up a database. Copying the files themselves that actually hold the data is not the usual backup method, for various complicated reasons. All relational databases work this way, or at least I've never heard of

Backup MySQL database

陌路散爱 提交于 2019-12-03 16:08:33
I have a MySQL Database of about 1.7GB. I usually back it up using mysqldump and this takes about 2 minutes. However, I would like to know the answers to the following questions: Does mysqldump block read and/or write operations to the database? Because in a live scenario, I would not want to block users from using the database while it is being backed up. It would be ideal for me to only backup the WHOLE database once in, say, a week, but in the intermediate days only one table needs to be backed up as the others won't change. Is there a way to achieve this? Is mysqlhotcopy a better

skip-lock-tables and mysqldump

北战南征 提交于 2019-12-03 16:05:10
问题 Daily we run mysql dumps on about 50 individual databases, package them up and then store them offsite. Some of these databases are rather large and contain myisam tables (which CANNOT be changed so suggesting it is pointless).. I have been reading up on using the skip-lock-tables option when doing a dump but have not read what the downside would be. All I see are basically different iterations of "it could have adverse effects if data is inserted to a table while it is dumping." What are

PhpMyAdmin export does not include PRIMARY KEY as mysqldump

可紊 提交于 2019-12-03 15:32:31
Export of the struture of the same table with PhpMyAdmin: `DROP TABLE IF EXISTS `test_apprentis`; CREATE TABLE IF NOT EXISTS `test_apprentis` ( `a_id` smallint(10) NOT NULL, `a_promo_id` smallint(11) NOT NULL, `a_cursus` smallint(10) DEFAULT NULL ) ENGINE=MyISAM AUTO_INCREMENT=3665 DEFAULT CHARSET=utf8;` Export with mysqldump: DROP TABLE IF EXISTS `test_apprentis`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `test_apprentis` ( `a_id` smallint(10) NOT NULL AUTO_INCREMENT, `a_promo_id` smallint(11) NOT NULL, `a_cursus`

How do I delete a table from a mysqldump

空扰寡人 提交于 2019-12-03 13:06:13
问题 How do I delete the output for one big table inside a mysqldump with lots of tables in it? I have a dump of a database that is 6 GB large, but 90% of it is only one logging-table "cache_entries", that I don’t need anymore inside my backup. How can I easily remove that bit inside the dump, that describes the large logging-table? I found this: http://gtowey.blogspot.de/2009/11/restore-single-table-from-mysqldump.html Example: grep -n 'Table structure' dump.sql and then for example: sed -n '40

MysqlDump from Powershell and Windows encoding

為{幸葍}努か 提交于 2019-12-03 12:32:29
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 change this ? A side note: I use Powershell to call mysqldump. UPDATE: it seems that it occurs only

我们却注意窗外的晴婷

大兔子大兔子 提交于 2019-12-03 11:43:05
事务 事务指一组操作,要么都成功,要么都不成功 /* start transaction sql语句 commit(提交)/rollback(回滚到start之前的状态) 特性 原子性 原子意为最小的粒子,即不能再分的事务,要么全部执行,要么全部取消 一致性 指事务发生前和发生后,数据的总额依然匹配 隔离性 某个事务的操作对其他事务不可见 持久性 当事务完成后,其影响应当保留下来,不能撤销;只能通过“补偿性事务”抵消之前的错误 存储引擎 MyIsam:辣鸡 InnoDB:牛逼 create table user( id int auto_increment primary key, name varchar(255) not null default'' )engine=Innodb charset utf8; # mysql 5.5 以上默认Innodb #MyIsam 不支持事务,InnoDB支持事务 #MyIsam 支持表锁,InnoDB支持行锁 视图 -- create view 视图名 as SQL语句 #删除 drop view 视图名 -- 限制权限 grant select on 视图名 to 用户名 -- 所有权限 grant all privileges on 视图名 to 用户名 触发器 delimiter // create trigger 触发器名