Skip to content
WJunction - Webmaster Forum

How to IMPORT MySQL database using SSH in Kloxo On VPS ??

Status
Not open for further replies.

9 comments

Awesome useful tool, I have coded a ssh script once before because I could never remember the correct syntax.

Code:
echo "MySQL Username"
read username
echo "MySQL Database"
read database
echo "MySQL File"
read file
mysql -u $username -p $database < $file

Copy and Paste, save as: mysqlimport.sh - chmod +x 755 and sh mysqlimport.sh and follow the onscreen prompts, I should update my easy ssh tools.
 
Last edited:
it should be

mysql -uusername -pdatabase_name < dumpfile.sql

That syntax is wrong. There's a space between -u and the username. There is, however, no space between -p and the password (or the password can be left blank and entered at the prompt that follows).


@OP
cd to the directory where the .sql file is hosted, then run the command
 
Status
Not open for further replies.

About the author

The Rock
Banned · Joined
59
Messages
0
Reactions
6
Points

Advertise on WJunction

Reach 1000's of webmasters, hosts & affiliates. Banner & sponsored-thread slots available.

Contact us
Back
Top Bottom