简体   繁体   中英

cannot upload large .sql database file to newly installed mysql using mysqldump in windows 7 <new mysql user>

I've checked through tons of forums and cannot seem to fix this. I need to upload a large database dump file (.sql) to mysql so that I can begin using the database as a key component of a website build project. I've tried various methods and I've been unsuccessful with all. First I tried to upload via phpmyadmin with no avail (it seems the file is too big). So I downloaded mysql and have begun learning cmd prompts (before I did that I tried to import from disk and from Dump Project Folder in MySQL Workbench - I received errors no matter where I put the file, eg in the MySQL Server 5.5\\bin folder or the folder where I originally had it C:\\Program Files\\my project\\test.sql - errors included "ERROR 1046 (3D000) at line 22: No database selected" ). Regarding command prompts, I've set up MySQL in environment variables path and when I enter:

mysql> source c:/program files/mysql/mysql server 5.5/bin/test.sql

The cmd freaks out and starts producing lines and lines of ERROR 1046 (...) then after a few minutes of producing lines it says Query OK, 0 rows affected <0.00 sec> for about 10 lines then returns to the "mysql>" prompt. I thought the fact that my file began with "g" may have been the problem so I changed it to start with "t" and it did the same thing. That seems to be the closest I've managed to come to accessing this file. I've been trying for months now. I really need to get into this file and I'm at a loss. Can someone please help??

You need to select a database, as your error says. I have no clue what your .sql file says, and why there is no "use DATABASE" string in there, but

  • Check if you have made a database ( show databases; )
  • If not made, make a database. (http://dev.mysql.com/doc/refman/5.0/en/create-database.html )
  • use the database with use databasename
  • load your script.

Login to MySQL and create a new database, say "mydatabase". Then run the following query on the command prompt (not inside MySQL)

mysql -u root -p mydatabase < my_large_db_dump.sql

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM