Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySql - trying to import a database, get message 'The system cannot find the file specified.'

Tags:

mysql

I installed MySql 4.1(because that what is running on my server), I got a file that is a dump of my database. It is about 4.6 GB.

I put that file in same location as MySql.exe lives C:\Program Files\MySQL\MySQL Server 4.1\bin

Then I go to command line and type in:

mysql -h localhost -u root -p [database name] < mysqlDump.sql

I get message back 'The system cannot find the file specified.'

What file is it referring to? The mysqlDump.sql?

Even when I specify the full path to the mySqlDump.sql file, I get the same message.

mysql -h localhost -u root -p [database name] < C:\Program Files\MySQL\MySQL Server 4.1\bin\mysqlDump.sql

I'm running MySql 4.1 on Windows7

update found out my mistake. My folder was hiding file extensions. Somehow when I saved the file on my machine I gave it an extra .sql extension. So the file had a name of mysqlDump.sql.sql

like image 212
dev.e.loper Avatar asked Nov 14 '25 14:11

dev.e.loper


2 Answers

You are probably not in the right directory when you make the call.

Go there:

cd "C:\Program Files\MySQL\MySQL Server 4.1\bin"

or specify the input file's absolute path:

mysql -h localhost -u root -p [database name] < "C:\Program Files\MySQL\MySQL Server 4.1\bin"
like image 189
Pekka Avatar answered Nov 17 '25 09:11

Pekka


Use TAB key when you are starting typing mysqlDump... to ensure that your file is there and you have privileges for it.

Tab key in command line will complete filename or not.

This will give you some information if the file exists and if you have permissions to that file. Maybe it was created from other operating system user account and you have no read privileges.

I put that file in same location as MySql.exe lives C:\Program Files\MySQL\MySQL Server 4.1\bin

This is not good idea, because regular operating system user accoung may have no privileges to write in Program Files directory.

To do it properly I would add C:\Program Files\MySQL\MySQL Server 4.1\bin to the PATH environment variable (link with howto). After you do this you will be able to run MySQL executable files from anywhere you want (like your desktop or documents folder for example) without messing around in Program Files. You can place your working file at location where you have all privileges and work on it from the command line.

like image 44
Kamil Avatar answered Nov 17 '25 09:11

Kamil