nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

ssh backup particular mysql table / database

This is a discussion on ssh backup particular mysql table / database within the Databases servers forums, part of the Mastering Servers category; I know nothing guys I really need help with this one I googled and google and I am tired please ...


Go Back   nixCraft Linux Forum > Mastering Servers > Databases servers

Linux answers from nixCraft.


Databases servers Discussions of databases of all types - especially MySQL.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 23-10-2007, 10:47 AM
Junior Member
User
 
Join Date: Oct 2007
OS: Debian
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
brothers is on a distinguished road
Default ssh backup particular mysql table / database

I know nothing guys I really need help with this one I googled and google and I am tired please help

I have a database with many many tables

I want only to use ssh

and backup all tables starting with phpbb_

into my public_html

Please let me know the commands I should use!
Reply With Quote
  #2 (permalink)  
Old 23-10-2007, 11:08 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 244 Times in 183 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Use mysqldump to backup entire database
Code:
mysqldump -u root -p dbname > backup.db.sql
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
  #3 (permalink)  
Old 23-10-2007, 11:53 AM
Junior Member
User
 
Join Date: Oct 2007
OS: Debian
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
brothers is on a distinguished road
Default

Thanks but I do not want to backup the entire database
I wan to only backup all tables starting with phpbb_
Reply With Quote
  #4 (permalink)  
Old 25-10-2007, 03:26 AM
jesse's Avatar
Junior Member
User
 
Join Date: Aug 2007
OS: gentoo&debian
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
jesse is on a distinguished road
Default

Just take a look at the help (mysqldump --help). The --tables option should do the trick.
__________________
teh.geekosphere.org
Reply With Quote
  #5 (permalink)  
Old 25-10-2007, 05:20 AM
Junior Member
User
 
Join Date: Oct 2007
OS: Debian
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
brothers is on a distinguished road
Default

Jesse I did not understand
Can you please type the exact command?
Is this possible?
Reply With Quote
  #6 (permalink)  
Old 25-10-2007, 09:42 AM
jesse's Avatar
Junior Member
User
 
Join Date: Aug 2007
OS: gentoo&debian
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
jesse is on a distinguished road
Default

Code:
mysqldump -u USER -p DATABASE --tables TABLE > TARGET.sql
Replace all uppercase words with your values, password will be prompted.
__________________
teh.geekosphere.org
Reply With Quote
  #7 (permalink)  
Old 25-10-2007, 09:52 AM
Junior Member
User
 
Join Date: Oct 2007
OS: Debian
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
brothers is on a distinguished road
Default

Jesse thanks but the problem is not one talble

See I have a series of tables all tables which start with

phpbb_
Reply With Quote
  #8 (permalink)  
Old 25-10-2007, 11:51 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 244 Times in 183 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Try something as follows (set db name, username and password)

Code:
#!/bin/bash
DBNAME="phpbb"
DBPASS="myPassWord"
DBUSER="admin"
DBHOST="localhost"
BACKUP="out.sql"
>$BACKUP
echo ""
echo -n "*** Dumping tables to $BACKUP file : "
TABLES=$(mysql -ss -h $DBHOST -u $DBUSER -p$DBPASS $DBNANE -e'show tables like "phpbb_%";')
for t in $TABLES
do
 echo -n " $t "
 mysqldump -h $DBHOST -u $DBUSER -p $DBPASS $DBNAME --tables "$t" >> $BACKUP
done
echo " *** Done."
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
  #9 (permalink)  
Old 25-10-2007, 12:31 PM
Junior Member
User
 
Join Date: Oct 2007
OS: Debian
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
brothers is on a distinguished road
Default

So do you mean I make a php script and run it?

sorry I have no Idea!

OK supposing this is my info

Db name: brothers
db password: 1234
dbuser: Me
Dbhost: local host

and I want to download all tables starting with phpbb2_


======================================
I want to backup my phpbb2 forum from among 500 of other tables which are not related and make a new database and restore it there
Reply With Quote
  #10 (permalink)  
Old 25-10-2007, 12:39 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 244 Times in 183 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

This is a shell script, it will not work from PHP until and unless you have shell access from your domain. If you have shell access it will work out.


If you don't have shell access get phpMyAdmin software upload the same and use export option select phpbb_ tables and download them to your local computer or to directory.

Download : phpMyAdmin | MySQL Database Administration Tool | www.phpmyadmin.net
See how to backup tables with this software : WordPress Backup with phpMyAdmin

Another option is use phpbb's own backup and restore table option.

Keeping in mind that if your tables are quite big, php may not work on shared hosting account due to restrictions.

Hope this helps!
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
how to do MYSQL online backup of huge database manish_2479 Databases servers 4 12-07-2008 12:36 PM
need to convert text files into mysql database zafar466 Databases servers 2 12-07-2008 12:31 PM
MySql FTP server backup script zafar466 Shell scripting 3 25-09-2007 05:43 PM
MySQL Backup Script krisa Shell scripting 1 02-02-2007 11:57 PM
How do I backup MySQL Databases? chiku All about FreeBSD/OpenBSD/NetBSD 2 19-08-2006 07:15 PM


All times are GMT +5.5. The time now is 06:56 AM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38