Hello.

I have a larger database that I want to import and I cannot do that using phpmyadmin. I tried to do this in many possible ways by command line, but I get message 'wrong syntax'.

I have Windows Vista, MySQl version 5.5.24, wamp server. The path to mysql.exe is: C:\wamp\bin\mysql\mysql5.5.24\bin\mysql.exe. The myfile.sql I located in the same folder with mysql.exe.

Using cmd I managed to go to mysql.exe:
mysql>

I have created a new database in MySql: mydatabase.

I wrote the following instructions after mysql> that gave the same error message:

mysql -u root -p mydatabase < myfile.sql
mysql -u [root] -p [mydatabase] < [myfile.sql]
mysql -u {root} -p {mydatabase} < {myfile.sql}
-u root -p mydatabase < myfile.sql
-u [root] -p [mydatabase] < [myfile.sql]
-u {root} -p {mydatabase} < {myfile.sql}

Please advise, where I am wrong. Thanks a lot.

$ mysql -uusername -ppassword db_name < /fullpath/text_file.sql

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.