LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-10-2013, 10:35 AM   #1
pizzipie
Member
 
Registered: Jun 2005
Location: Hayden, ID
Distribution: Ubuntu 20.04
Posts: 441

Rep: Reputation: 12
PHP/MYSQL - mysqldump creates file with commented out instructions.


In my recent thread re: PHP5 and chown() the reason I was using chown() to try to change owners originated from the fact that I could'nt get mysqldump to "CREATE DATABASE IF NOT EXISTS".

So, the below code shows what mysqldump does produce. Rather than take out the /*!40000's and the /*!32312 and the /*!40100 manually I will ask what is going on here. Is this some kind of response to an error? I couldn't find MYSQL error codes that correspond to these numbers so don't have any clue what is going on.

Code:
--
-- Current Database: `test`
--

/*!40000 DROP DATABASE IF EXISTS `test`*/;

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */;

USE `test`;

--
-- Table structure for table `address`
--

DROP TABLE IF EXISTS `address`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `address` (
  `id` int(5) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `street` varchar(50) NOT NULL,
  `town` varchar(50) NOT NULL,
  `state` var
 
Old 09-11-2013, 02:05 AM   #2
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591

Rep: Reputation: 145Reputation: 145
mysqldump --skip-comments

Would that help maybe? Actually the following is not a comment:
/*!40101 SET @saved_cs_client = @@character_set_client */;
(In htese parts there are some variables set)
 
Old 09-11-2013, 07:32 AM   #3
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
The -- lines are the comments, the /* */ sections are directives that apply to specific versions of MySQL but will be ignored if the version of MySQL reading the dump file doesn't support them.
 
Old 09-11-2013, 08:45 AM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by pizzipie View Post
In my recent thread re: PHP5 and chown() the reason I was using chown() to try to change owners originated from the fact that I could'nt get mysqldump to "CREATE DATABASE IF NOT EXISTS".

So, the below code shows what mysqldump does produce. Rather than take out the /*!40000's and the /*!32312 and the /*!40100 manually I will ask what is going on here. Is this some kind of response to an error? I couldn't find MYSQL error codes that correspond to these numbers so don't have any clue what is going on.

Code:
--
-- Current Database: `test`
--

/*!40000 DROP DATABASE IF EXISTS `test`*/;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
https://en.wikibooks.org/wiki/C%2B%2...tions/Comments
http://kedar.nitty-witty.com/blog/sq...s-in-mysqldump
https://dev.mysql.com/doc/refman/5.1/en/mysqldump.html
 
1 members found this post helpful.
Old 09-11-2013, 01:25 PM   #5
pizzipie
Member
 
Registered: Jun 2005
Location: Hayden, ID
Distribution: Ubuntu 20.04
Posts: 441

Original Poster
Rep: Reputation: 12
[SOLVED]

Thank you folks. Very helpfull.

R
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] mysqldump keeps asking mysql password jonaskellens Linux - Newbie 4 08-18-2011 04:29 AM
[SOLVED] Cron - mysqldump job creates an empty sql file novice32 Linux - Newbie 5 04-17-2010 12:12 PM
Trouble following Install Instructions (PHP-MYSQL) snowweb Linux - Software 2 12-23-2009 08:18 AM
php log file that traces php to mysql connections troubles ! mehdi1973 Linux - Software 12 07-14-2009 01:50 AM
MySQL can't connect(skip-networking commented) mrcheeks Debian 0 11-21-2004 11:30 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration