coolcommands.com - the search engine for unix sysadmins :: unix commands and scripts
Monday September 6, 2010


 Home
 Search
 Advanced Search
 Category Search
 Affiliates
 Acknowledgements
 Cool Links

Username

Password

Remember me
Forgot your password?
Create an account

Who's Online
We have 32 guests online

Newest Member

Starmamex

Hit Counter
4760808 Visitors

cool Statistics
coolcommands:1313
Categories:82
Total queries:523831
Members:4281





Search coolcommands.com
Search Keyword:


coolcommand

how to copy a table in mysql and rename it
Description

To copy a table in mysql and rename it:

First way:

1) Dump the table you want:

# /usr/bin/mysqldump --opt -u root -c --all --password=pwd dbname dbtable > dump.sql

2) Use sed to rename the table:

# sed -e 's/old_table_name/new_table_name/g' dump.sql > dump2.sql

3) Restore your new table in the same database:

# mysql -u root -p dbname < dump2.sql

OR

# mysql -u root -p

mysql> use dbname;

mysql> alter table old_tablename rename new_tablename;
Example

sed -e 's/old_table_name/new_table_name/g' dump.sql > dump2.sql

Return to search results

Random coolcommands

coolcommand: how to create users in mysql
Example: grant select on dbname.* to nobody@phoque identified by 'badpass';
[show me the details]
coolcommand: how to reread the /etc/inittab file in Linux
Example: telinit q
[show me the details]
coolcommand: crfs - how to create a filesystem in IBM AIX
Example: crfs -v jfs -a bf=true -d'localvglv01' -m'/newdata' -A'yes' -p'rw' -t'no' -a nbpi='4096' -a ag='64'
[show me the details]
coolcommand: swinstall - how to install depot files in HP/UX
Example: swinstall -s /tmp/perl.depot
[show me the details]

coolcommands.com - the search engine for UNIX sysadmins :: unix commands and scripts



FREE
myPMS

Password
Management
System

by

LVOware.com




Top 5 Submitters

lvo1138
audet37
kah00na32
Mariom24
lebjf00013

Top 5 Searches

Category Solaris42690
Category AIX38082
Category General UNIX34254
solaris20802
aix19388

Terms of Use
Privacy
Contact


 
coolcommands.com © 2010. All Right Reserved.
Programming by PRATTICO Consulting . Hosting by Apricusum