LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   PHP/MYSQL - mysqldump creates file with commented out instructions. (https://www.linuxquestions.org/questions/programming-9/php-mysql-mysqldump-creates-file-with-commented-out-instructions-4175476612/)

pizzipie 09-10-2013 10:35 AM

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


j-ray 09-11-2013 02:05 AM

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)

TenTenths 09-11-2013 07:32 AM

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.

Habitual 09-11-2013 08:45 AM

Quote:

Originally Posted by pizzipie (Post 5025310)
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

pizzipie 09-11-2013 01:25 PM

[SOLVED]

Thank you folks. Very helpfull.

R


All times are GMT -5. The time now is 09:45 PM.