简体   繁体   中英

how to import notepad .txt file in phpmyadmin MySql

I have a .txt file in notepad that's 31 mb and I'm unsure as to how to import it into phpmyadmin. I've looked at similar questions on stackExchange to no avail. Everytime I try to upload it I get the error "You probably tried to upload too large file. Please refer to documentation for ways to workaround this limit." Thinking that the file was too large I even modified it to only 3 lines as a test and I got an entirely different error! I'm sure one of my problems is that there is no option that says .txt and I can only choose from CSV, SQL, DocSQL, Open Document Spreadsheet and XML. So I'm assuming I must covert my .txt file to one of those files to upload unless of course there's an entirely different way of importing that I am not aware of. Some of the code in question on my .txt file reads as

CREATE TABLE IF NOT EXISTS occupationalinfo (
`ID` VARCHAR(255),
`Title` VARCHAR(255),
`DESCRIPTION` VARCHAR(255)) TYPE=MyISAM;


INSERT IGNORE INTO occupationalinfo (`ID`,`Title`,`DESCRIPTION`) VALUES  
('1','Architects, Except Landscape and Marine','CODE: 22302   TITLE: Architects, Except Landscape and Marine   DEFINITION: Plan and design structures, such as private residences, office buildings, theaters, factories, and other structural property.    TASKS  KNOWLEDGE  SKILLS  ABILITIES  WORK ACTIVITIES  WORK CONTEXT  INTERESTS  WORK VALUES  CROSSWALKS   TASKS: 1. Prepares information regarding design, structure specifications, materials, color, equipment, estimated costs, and construction time.   2. Plans layout of project.   3. Integrates engineering element into unified design.  

I am still in the early learning phases of programming so any tips followed by explanations would be greatly appreciated

You can change the extension of the file from .txt to .sql. It's no mystery, they're both text files. As long as it contains SQL like you have above, you will be fine.

If you have command-line access to the server, upload the file separately and run it from the command line using mysql .

You can also try temporarily increasing the upload file-size limit, although 31 MB is really big.

If you have a modern installation of phpmyadmin with the PHP zip extension, you can change the file extension to .sql, zip it and then upload it. It should be radically smaller than 31 MB.

The most definite solution however is to break it up: go through your file and separate out each table, and each collection of say 500 insert statements. Save them as separate files, upload and run them in order in phpmyadmin.

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