mysqldump

Import single database from --all-databases dump

99封情书 提交于 2019-12-04 07:24:27
问题 Is it possible to import a single database from an --all-databases mysqldump? I guess I can modify the file manually but wondering if there are any command line options to do this. I am moving servers and have a lot of databases, most of which I don't currently need or want at the moment but would like to have the option to restore a single one if need be. 回答1: mysqldump output is just a set of SQL statements. You can provide the desired database in the command line and skip the commands

How can I get mysqldump to preserve the case of table names?

帅比萌擦擦* 提交于 2019-12-04 07:03:53
I'm attempting to migrate a database from a windows to a linux host. Thanks! Ashley You are not finding the the table names under linux mysql, coz its default is case-sensitive. And for windows its case-insensitive. I can't guess if ignoring case sensitivity works for you. But you can do by adding a line in my.conf. i.e. making mysql in linux to be case insensitive. mysqlserver:~# vi /etc/mysql/my.cnf ... [mysqld] lower_case_table_names = 1 Check out the following links and see if that helps: http://bugs.mysql.com/bug.php?id=33898 http://dev.mysql.com/doc/refman/5.1/en/identifier-case

Foreign key constraints while dumping data

。_饼干妹妹 提交于 2019-12-04 06:59:43
问题 mysqldump --compact --no-create-info -h192.168.150.180 -uroot -p live pnlbus_stops | sed s/pnlbus_stops/bus_stops/g | mysql test I am getting an error: ERROR 1062 (23000) at line 1: Duplicate entry 'AN' for key 1 This is because bus_stops table in the test DB has foreign key constraints. How do I truncate the bus_stops table from test database in a SINGLE STATEMENT before inserting from "live" DB? 回答1: put set FOREIGN_KEY_CHECKS = 0; at the top of your dump file and put SET FOREIGN_KEY_CHECKS

generating database with different name from mysqldump backup

£可爱£侵袭症+ 提交于 2019-12-04 06:33:57
The database "db" is backuped in backup.sql. Is there a way to restore database from script with different from "db" name? thank you in advance! Sure, when you import it you do this right: mysql -uuser -ppassword databasename < mydump.sql You can put anything you want where I wrote databasename - as long as that database actually exists :) If the name of the database is include the SQL file, I didn't find any other way than modify the SQL file. My favorite command to do it : sed -i "s/\`old_db_name\`/\`new_db_name\`/g" my_sql_file.sql This depends on how you created your MySQL dB dump file for

Skip or ignore definers in Mysqldump

荒凉一梦 提交于 2019-12-04 05:06:29
I was wondering if I can prevent mysqldump inserting this commands /*!50017 DEFINER=`root`@`localhost`*/ Or if I have to do it afterwards with sed, for example Thanks! This issue has been around since 2006 with no sign of ever being fixed. I have, however, piped it through grep (linux only) to trim out the definer lines before writing the dump file: mysqldump -u dbuser -p dbname | grep -v 'SQL SECURITY DEFINER' > dump.sql A bit of a mouthful (or keyboardful?) but I think it's the only way. 来源: https://stackoverflow.com/questions/11901344/skip-or-ignore-definers-in-mysqldump

mysqldump: Got errno 32 on write: 'all of a sudden' plenty of room still…Drupal 6 installation

白昼怎懂夜的黑 提交于 2019-12-04 01:46:21
On the dev server, I tried to run the same script I've been using for almost a year and at the end got the : mysqldump: Got errno 32 on write Last week, the IT sysadmin just restored the virtual server to a few days before backup and it all worked. The Drupal install is fine and the live server is fine (a duplicate of the dev server)...we have about 30 or so virtual servers all on the same box and the IT SysAdmin has allocated quite a few resources. Here's what I get with df -h on the dev: Filesystem Size Used Avail Use% Mounted on /dev/sda1 18G 6.1G 12G 36% / udev 1000M 4.0K 1000M 1% /dev

hive从0.12.0升级到1.2.1步骤详解及填坑

别等时光非礼了梦想. 提交于 2019-12-04 00:40:17
hive升级步骤详解(hive-0.12.0到hive-1.2.1) 升级步骤: 1.关闭当前与hive相关的所有进程 2.备份MySQL的hive数据库 mysqldump -uroot -proot hive > schem_hive-0.12.0.sql 方便升级失败之后回滚。 3. 修改环境变量HIVE_HOME 4. 解压1.2.1的安装包, 进入目录: hive-1.2.1/scripts/metastore/upgrade/mysql/ 下面有如下的脚本: upgrade-0.12.0-to-0.13.0.mysql.sql upgrade-0.13.0-to-0.14.0.mysql.sql upgrade-0.14.0-to-1.1.0.mysql.sql upgrade-1.1.0-to-1.2.0.mysql.sql 执行脚本: mysql -uroot -proot hive < upgrade-0.12.0-to-0.13.0.mysql.sql 操作成功 Finished upgrading MetaStore schema from 0.12.0 to 0.13.0 此时数据库的结构只适应0.13系列的,可以选择做个备份: mysqldump -uroot -proot hive > schem_hive-0.13.0.sql 下面依次执行:

How to restore the database double encoded by mysqldump

浪尽此生 提交于 2019-12-03 21:34:04
I use the mysqldump to make a backup of my database. My database was destroyed by an accident and now I want to restore it. But the SQL file is double encoded by bug#28969. http://bugs.mysql.com/bug.php?id=28969 Is there any solution for my data to go back? I only have the SQL file made by mysqldump. Thanks. I got my data back. Thanks everyone. By this way, 1.import the messy data 2.use sqldump as 'mysqldump -h "$DB_HOST -u "$DB_USER" -p"$DB_PASSWORD" --opt --quote-names --skip-set-charset --default-character-set=latin1 "$DB_NAME" > /tmp/temp.sql' Reference http://pastebin.com/iSwVPk1w shk3 I

How to find Missing Indexes in MySQL?

别说谁变了你拦得住时间么 提交于 2019-12-03 20:22:57
5 and i want to identify missing indexes in it. Can somebody please help me to identify ? This will help us to increase the performance of query that leads to application. Rahul Tripathi The best what I can think of is to use the EXPLAIN to check the execution plan of your query with index and without index and then see the difference in query performance. You can also refer: Does MySQL exectution plan depend on available indexes? Using EXPLAIN to Write Better MySQL Queries How to find un-indexed queries in MySQL, without using the log 来源: https://stackoverflow.com/questions/30626876/how-to

laravel5+ElasticSearch+go-mysql-elasticsearch MySQL数据实时导入(mac)

一笑奈何 提交于 2019-12-03 20:18:47
1. ElasticSearch安装 直接使用brew install elasticsearch 安装最新版本的es,基本没有障碍。 2.Laravel5 框架添加elasticsearch支持 在composer.json文件中添加elasticsearch-php依赖: 执行composer命令更新es代码加载到当前laravel框架中   composer update   laravel控制器中使用es   use Elasticsearch\ClientBuilder;//引入   $client = ClientBuilder::create()->build();//初始化   $params = [   'index' => 'my_index',   'type' => 'my_type',   'id' => 'my_id',   'body' => ['testField' => 'abc']   ];   $response = $client->index($params);//添加索引   print_r($response);   $params = [   'index' => 'my_index',   'type' => 'my_type',   'id' => 'my_id'   ];   $response = $client->get(