User login

Backing up, restoring, making test databases with MySQL command line

increase phpmyadmin upload size limit
forget it.

mysql from command line

mysqldump -u internetbar_live -p

--ignore-table=name

worked- (few misstarts, didn't like having a password included, placement of db name)

mysqldump -u internetbar_live -p --ignore-table=internetbar_live.ibcdru_watchdog internetbar_live > internetbar_backup.sql

One line. One goddamn line. And you can get the password you need from settings.php

mysqldump -u anderson_live -p --ignore-table=anderson_live.cdm_org_watchdog anderson_live > anderson_backup.sql

That's all one line.

Even faster:

mysqldump -u dbuser -pThePasswordString dbname > dbbackup.sql

Note that that's a -p followed by the password, without a space.

Question: Is it possible to choose structure only for certain tables while making a MySQL dump?

(Note: if you get a 1045 access denied message, check if your password has weird characters.)

for extra safety, get it off the server:

Ebony-697:~/Documents/Web Sites Data/COA News & FSTV/media reform job ben$ scp ben@66.135.37.243:/var/www/drupal-5-live/sites/democraticmedia.ca/anderson_backup.sql anderson_backup.sql

mysql -u [username] -p [password] [database_to_restore] < [backupfile]

mysql -u internetbar_test -p internetbar_test < internetbar_backup.sql

Afterward, of course, you have to do this:

CREATE TABLE agaricdesign_com_ibcdru_watchdog (
wid int(11) NOT NULL auto_increment,
uid int(11) NOT NULL default '0',
type varchar(16) NOT NULL default '',
message longtext NOT NULL,
severity tinyint(3) unsigned NOT NULL default '0',
link varchar(255) NOT NULL default '',
location text NOT NULL,
referer varchar(128) NOT NULL default '',
hostname varchar(128) NOT NULL default '',
timestamp int(11) NOT NULL default '0',
PRIMARY KEY (wid),
KEY type (type)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=860656 ;

and this will increase as we exclude content from more tables (cache, )

and this must be automated

along with all steps for copying a database.

increase phpmyadmin upload size limit forget it. mysql from command line mysqldump -u internetbar_live -p --ignore-table=name worked- (few misstarts, didn't like having a password included, placement of db name) mysqldump -u internetbar_live -p --ignore-table=internetbar_live.ibcdru_watchdog internetbar_live > internetbar_backup.sql One line. One goddamn line. And you can get the password you need from settings.php mysqldump -u anderson_live -p --ignore-table=anderson_live.cdm_org_watchdog anderson_live > anderson_backup.sql That's all one line. Even faster: mysqldump -u dbuser -pThePasswordString dbname > dbbackup.sql Note that that's a -p followed by the password, without a space. Question: Is it possible to choose structure only for certain tables while making a MySQL dump? (Note: if you get a 1045 access denied message, check if your password has weird characters.) for extra safety, get it off the server: Ebony-697:~/Documents/Web Sites Data/COA News & FSTV/media reform job ben$ scp ben@66.135.37.243:/var/www/drupal-5-live/sites/democraticmedia.ca/anderson_backup.sql anderson_backup.sql mysql -u [username] -p [password] [database_to_restore] < [backupfile] mysql -u internetbar_test -p internetbar_test < internetbar_backup.sql Afterward, of course, you have to do this: CREATE TABLE `agaricdesign_com_ibcdru_watchdog` ( `wid` int(11) NOT NULL auto_increment, `uid` int(11) NOT NULL default '0', `type` varchar(16) NOT NULL default '', `message` longtext NOT NULL, `severity` tinyint(3) unsigned NOT NULL default '0', `link` varchar(255) NOT NULL default '', `location` text NOT NULL, `referer` varchar(128) NOT NULL default '', `hostname` varchar(128) NOT NULL default '', `timestamp` int(11) NOT NULL default '0', PRIMARY KEY (`wid`), KEY `type` (`type`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=860656 ; and this will increase as we exclude content from more tables (cache, ) and this *must be automated* along with all steps for copying a database.

Comments

Might as well post why phpMyAdmin is not an option

One of the errors that forced me from PHPMyAdmin, even after laboriously cutting down the file to fit the silly upload limit...

Error
There is a chance that you may have found a bug in the SQL parser. Please examine your query closely, and check that the quotes are correct and not mis-matched. Other possible failure causes may be that you are uploading a file with binary outside of a quoted text area. You can also try your query on the MySQL command line interface. The MySQL server error output below, if there is any, may also help you in diagnosing the problem. If you still have problems or if the parser fails where the command line interface succeeds, please reduce your SQL query input to the single query that causes problems, and submit a bug report with the data chunk in the CUT section below:
----BEGIN CUT----
eNrVk02PmzAQhjn7V8xhpU3UgGwnQEKVg5t1s6h8pEBW2r2AQ7wNKmFTMKvm36/J9tBKVdtDVanv
ZQ7zzPi1PcOTJE48WBFYUQh45AHFQAm4ixlKM50xEFrdpR5c+XsPui/1SbSdbK262lmnwwkWU+Lq
EuyYeG4SB4jrzaiHyQPU8riAKxSe04+BB7aFrSk1b+SuEk3uSlUeiFk/fULbNIE4nQBb8yibwB3X
Z4aihDB+8IOADYVoEzLty1pYxCLfWphTtLndDPgkTof21MLm/M3Q14WgavqvKGDR2gPZmL16NOfo
YqNqlGwbqXaizevqWVr6RsZfFtZybfs1Oj9Eionjui4xCHZsQmxCKTEwmVKHGICNf6C+U6IFMHay
+SX3u/x/Kj3MCWcZh4y9CzgU1a7ct30uylJ2XQEjBFCIal8MgzIiZAxRnEG0DQIQvXrKq6Zs5VE2
ajKAR9F9LuBZtOVBtCNq29/he/ko+lrB9fUFVeeT/ENUf5DqtRdVNefBxexnKL6wm8QPWXIPH/g9
wOhifIzGwKO1H/FlePZTFsINf8+2QQarW5akPFvqbZgD22Zx7kf6MUK9dksCb18A5f+n+g==
----END CUT----
----BEGIN RAW----

ERROR: C1 C2 LEN: 20 21 794
STR: ?

CVS: $Id: sqlparser.lib.php 9317 2006-08-16 17:42:01Z lem9 $
MySQL: 5.0.32-Debian_7etch1-log
USR OS, AGENT, VER: Mac MOZILLA 5.0
PMA: 2.9.1.1-Debian-3
PHP VER,OS: 5.2.0-8+etch7 Linux
LANG: en-utf-8
SQL: internetbar_live.sql????????????????????????????????????????????????????????????????????????????????0000755?0000765?0000765?00020167771?10651151221?013261? 0????????????????????????????????????????????????????????????????????????????????????????????????????ustar ?ben?????????????????????????????ben????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

CREATE TABLE `agaricdesign_com_ibcdru_access` (
`aid` int(11) NOT NULL auto_increment,
`mask` varchar(255) NOT NULL default '',
`type` varchar(255) NOT NULL default '',
`status` tinyint(4) NOT NULL default '0',
PRIMARY KEY (`aid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

----END RAW----

SQL query:

internetbar_live.sql????????????????????????????????????????????????????????????????????????????????0000755?0000765?0000765?00020167771?10651151221?013261? 0????????????????????????????????????????????????????????????????????????????????????????????????????ustar ?ben?????????????????????????????ben???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? CREATE TABLE `agaricdesign_com_ibcdru_access` ( `aid` int(11) NOT NULL auto_increment, `mask` varchar(255) NOT NULL default '', `type` varchar(255) NOT NULL default '', `status` tinyint(4) NOT NULL default '0', PRIMARY KEY (`aid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'internetbar_live.sql' at line 1

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.