techmonkey
06-01-2004, 06:31 PM
I have backed up a lot of databases via the command line, but tonight I need to do some work on individual tables of a very large database. What is the syntax to dump individual tables in MySQL (Linux command line)?
Thanks!
ilyash
06-01-2004, 07:08 PM
mysqldump -uUSER -pPASS TABLE > TXTFILE.txt [or other file]
Burhan
06-02-2004, 02:33 AM
You can also use database.tablename, and if you just use -p mysql will prompt you for the password. On some systems, users that can view processes will be able to see your password if you enter it directly at the shell prompt.
techmonkey
06-02-2004, 11:32 PM
OK, so I have a dump of an entire db that I am trying to move to another server. On the new server, the new db exists but is empty. How do I run my backup.sql file on this db? I login into Mysql, then switch to the db I want to use but I can't seem to find the command to run the file. What am I doing wrong?
techmonkey
06-03-2004, 12:58 AM
[root@myserver]# mysqldump my_db -u my_dbuser -p < /home/ridemonkey/phpads.sql
I've tried this and the mysql equivalent but am having no luck. I don't get an error, but the db is still empty. I can import the file via phpadsnew fine - so the db and the file are ok.
Burhan
06-03-2004, 02:40 AM
You need
mysql -u username -p databasename < /path/to/file.sql
techmonkey
06-05-2004, 10:55 AM
Originally posted by fyrestrtr
You need
mysql -u username -p databasename < /path/to/file.sql
I tried that and it wasn't working either. It turned out that when I was downloading the sql files to my Mac, it was converting Unix line breaks to Mac line breaks. When I uploaded the SQL file to the new server, it couldn't be imported correctly. Fixed now though.