mysqldump

Backing Up Views with Mysql Dump

谁说胖子不能爱 提交于 2019-12-17 22:23:19
问题 I want to back up only the Views with mysqldump. Is this possible? If so, how? 回答1: NOTE: This answer from Ken moved from suggested edit to own answer. here's a full command line example using a variant of the above mysql -u username INFORMATION_SCHEMA --skip-column-names --batch -e "select table_name from tables where table_type = 'VIEW' and table_schema = 'database'" | xargs mysqldump -u username database > views.sql This extracts all of the view names via a query to the INFORMATION_SCHEMA

Error importing SQL dump into MySQL: Unknown database / Can't create database

馋奶兔 提交于 2019-12-17 22:04:36
问题 I'm confused how to import a SQL dump file. I can't seem to import the database without creating the database first in MySQL. This is the error displayed when database_name has not yet been created: username = username of someone with access to the database on the original server. database_name = name of database from the original server $ mysql -u username -p -h localhost database_name < dumpfile.sql Enter password: ERROR 1049 (42000): Unknown database 'database_name' If I log into MySQL as

Using PHP script: why mysqldump does not dump sql file?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-17 21:14:00
问题 Hye, I'm new in PHP and trying to use mysqldump using php script. I already try using command and the dump process is success. The situation is, when I tried dump using my local computer, the dump is succeed. But when the code is transfer into the server, mysqldump doesn't work. I have tried almost the solution related to mysqldump topics, but still it doesn't work. I hope someone can guide me. TQ <?php /*----------------------------------------------- MYSQLDUMP FOR SERVER -------------------

mysqldump data only

爱⌒轻易说出口 提交于 2019-12-17 17:28:14
问题 I am looking for the syntax for dumping all data in my mysql database. I don't want any table information. 回答1: mysqldump --no-create-info ... If you are using triggers you also need to include --skip-triggers And if you are using the --databases ... option you also need to include --no-create-db 回答2: This should work: # To export to file (data only) mysqldump -u [user] -p[pass] --no-create-info mydb > mydb.sql # To export to file (structure only) mysqldump -u [user] -p[pass] --no-data mydb >

how to mysqldump remote db from local machine

℡╲_俬逩灬. 提交于 2019-12-17 17:21:04
问题 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

How to deal with enormous line lengths created by mysqldump

假如想象 提交于 2019-12-17 15:15:14
问题 I'm using mysqldump in a cron job to backup a database with over 2 million rows. It creates a text file which can be used to restore the datalog from the command line. I thought it would be useful to edit the dump before a restore as a quick way of changing values and table or column names - at least until I learn more and become confident about doing it with ALTER and UPDATE. Editing large text files does not bother me, but I was surprised to find that in a 250 megabyte dump of my database,

How can I slow down a MySQL dump as to not affect current load on the server?

北城余情 提交于 2019-12-17 10:11:07
问题 While doing a MySQL dump is easy enough, I have a live dedicated MySQL server that I am wanting to setup replication on. To do this, I need dumps of the databases to import to my replication slave. The issue comes when I do the dumps, MySQL goes full force at it and ties up resources to the sites that connecting to it. I am wondering if there is a way to limit the dump queries to a low priority state to which preference is given to live connections? The idea being that the load from external

Where I can find a list of “mysqldump” exit codes?

我怕爱的太早我们不能终老 提交于 2019-12-17 09:55:35
问题 I know that exit code = 0 means No error . I got exit code = 2 . What does it means ? Where I can see the complete list of mysqldump exit codes ? 回答1: Taken from client/mysqldump.c in MySQL 5.1.59: #define EX_USAGE 1 #define EX_MYSQLERR 2 #define EX_CONSCHECK 3 #define EX_EOM 4 #define EX_EOF 5 /* ferror for output file was got */ #define EX_ILLEGAL_TABLE 6 Skimming through the source, EX_MYSQLERR seems to be used mostly for errors from the server, but also in case malloc fails. CONSCHECK

MySQL学习之数据库导入与导出(Windows下)

我只是一个虾纸丫 提交于 2019-12-17 07:17:34
目录 数据库导出 数据 + 结构 结构 数据表导出 数据 + 结构 结构 数据库导入 数据表导入 数据库导出 数据 + 结构 # CMD终端运行: MySQL导出数据库 ( 包括数据结构 + 数据 ) : mysqldump - u root - p db - name > db_nickname_bak . sql 结构 # MySQL导出数据库(只包括数据结构): mysqldump - u root - p - d db - name > db_nickname_bak . sql 数据表导出 数据 + 结构 # MySQL导出数据表(包括数据结构+数据): mysqldump - u root - p db - name tb - name1 tb - name2 . . . > tb_name_name_bak . sql 结构 # MySQL导出数据表(只包括数据结构): mysqldump - u root - p - d db - name tb - name1 tb - name2 . . . > tb_name_name_bak . sql 数据库导入 1 进入MySQL命令行 2 创建一个数据库 db 3 进入db 4 执行source 路径 ( 数据库备份文件的路径 ) ( 这条语句最后不加分号 ; ) 数据表导入 1 进入CMD命令行 2 执行 mysql

#1071 - Specified key was too long; max key length is 1000 bytes

a 夏天 提交于 2019-12-17 02:09:26
问题 I know questions with this title have been answered before, but please do read on. I've read thoroughly all the other questions/answers on this error before posting. I am getting the above error for the following query: CREATE TABLE IF NOT EXISTS `pds_core_menu_items` ( `menu_id` varchar(32) NOT NULL, `parent_menu_id` int(32) unsigned DEFAULT NULL, `menu_name` varchar(255) DEFAULT NULL, `menu_link` varchar(255) DEFAULT NULL, `plugin` varchar(255) DEFAULT NULL, `menu_type` int(1) DEFAULT NULL,