Title: DROP TABLE before view definition incorrect in mysqldump output
Tags: mysql;view;mysqldump
Question: I have a mysql database on a shared web host. Some of the tables are rather large, and our nightly dump process was getting killed. So I made a script that queried the database for all the table names , and dumped them individually, concatenating them all into a single file.
mysql -uusername -ppassword -hhostname dbname < <(echo 'SHOW TABLES') | xargs -I TableName sh -c 'nice -19 mysqldump --opt -uusername -ppassword -hhostname dbname TableName &gt;&gt; /path/to/dump.sql'
I have the problem now where one of the view definitions (as I understand, MySQL has idiosyncratic view creation statements in its dump file) causes the error
ERROR 1146 (42S02) at line 5182: Table 'dbname.vView' doesn't exist
I looked up line 5182 in the dump file and it's this first line, which begins the creation of the view:
/*!50001 DROP TABLE `vView`*/;
/*!50001 DROP VIEW IF EXISTS `vView`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
Yet for whatever reason, other views in the dump file have
/*!50001 DROP TABLE IF EXISTS `vOtherView`*/;
And they get created okay.
Following this question, I tried mysql -f when importing the dump, but mysql still halted on the error.
How can I get the dump file to have a properly formatted view creation statement (outside of doing some post-processing of the dump file)? Or how can I get mysql to forge ahead regardless?

Here is the accepted answer: Never understood what the problem was, but my workaround was to first dump just the table definitions with --no-data, and then use the xargs to individually dump each table's data with --no-create-table.
Comment for this answer: I think it should be `--no-create-info` ?


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2012:00:04/29/12', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<mysql><view><mysqldump>', 'Title': 'DROP TABLE before view definition incorrect in mysqldump output', 'ViewCount': 831, 'id': 10369581, 'user_AboutMe': '', 'user_AccountId': 50872.0, 'user_DisplayName': 'user151841', 'user_Reputation': 16658.0, 'user_Views': 740.0, 'user_id': 151841.0}}