Trouble restoring DB through SSH



I am trying to move my forum from one directory to another on the same domain. The main reason I am doing this is because the new version of the software works best with php5 and the older database is running a lower version.

The database dump is on the server on the same domain (but in a different folder from the target folder)

The SSH command I am giving to restore the database is as follows: (username and directory names are not real)

mysql -u USERNAME -p NEWDATABASE < /home/.cash/etcetc/ect/forumbackup.sql

However this results in the following error:

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

Can someone please shed some light on this problem for me and offer a possible solution as well?

Thanking you,

PS: One thing I forgot to mention is that the database size is 132MB so it is not possible for me to restore it using phpmyadmin since it only allows 10mb files at a time and copying and pasting the whole db as a query would take me ages!


Well, the main problem I see is that, as far as I know, MySQL does not normally run on the same host where your files are stored. You need to tell the mysql program to use your MySQL host using the -h flag. Usually, your MySQL host is located at mysql.yourdomain.tld, but you can check for sure in your web control panel under Goodies -> Manage MySQL. Try using mysql -h mysql.yourdomain.tld -u username -p databasename < dumpfile.sql
As a side note, if all you’re doing is moving your forum installation from one directory to another, why are you messing around with the database? The database itself isn’t installed in your filesystem, so simply reorganizaing your files won’t affect your database at all.



Thanks for the solution, I have tried it out just now, it is very slowly (but surely) restoring the tables.

I have waited for about 15 mins to see if things get moving and they seem to be going very slow but definately progress is being made as I can see the tables being restored in the phpmyadmin back end slowly.

As for why I am moving databases, the reason is because when a new db is created on DH currently it is with php5. The older ones are still running php4.

Many of the upgrades of the modules/components for my portal/forum require php5 to be present, so as a result I have been unable to upgrade. Since I have already fallen back a LOT in upgrades of the softwares running my site, I decided to take these drastic measures :stuck_out_tongue:

Once again thank you very much for sharing your knowledge and providing me with a solution for this problem :smiley:

I will post again if I have any problems in this regards. Thank you so much!