|
| cool Statistics |
| | coolcommands: | 1313 | | Categories: | 82 | | Total queries: | 523831 | | Members: | 4281 | |
|
|
|
 |
|
|
Search coolcommands.com
 |
Submitted by:
lvo   |
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
|  |  |  |  |
|
|
|
|
 |
|
|
|
Top 5 Submitters
|
|---|
| lvo | 1138 |
| audet | 37 |
| kah00na | 32 |
| Mariom | 24 |
| lebjf000 | 13 |
Top 5 Searches
|
| Category Solaris | 42690 |
| Category AIX | 38082 |
| Category General UNIX | 34254 |
| solaris | 20802 |
| aix | 19388 |
|
|
|
|