09. IT

FireFox에서 sqlite export 할 수 있는 add-in

오뉴 2013. 10. 29. 13:45

http://otland.net/threads/convert-sqlite-to-mysql-database-with-pictures.47742/


Well to start this off I'll just say that I was trying to import my sqlite database into a MySQL database and had no idea. Well after many hours, sweat & tears etc... I've come up with an answer! :p

1. Download Firefox if you don't have it; Firefox Browser | Free ways to customize your Internet

[​IMG]


2. Download this sql2mysql converter addon; https://addons.mozilla.org/en-US/firefox/addon/5817
[​IMG]


3. When it's done installing, restart firefox, then go to Tools, "SQLite Manager"
[​IMG]


4. The program will open up, you should click on the "Connect Database" icon (looks like a folder).
[​IMG]


5. Select and find your previous SQLite database (make sure you enable "all files" searching!)
[​IMG]


6. Go to "File", "Database" and select "Export Database" and save it in the same location, but with a ".sql" filetype.


7. Now I suggest downloading "Notepad++" (found here; Notepad++ ) to edit your server, but "Notepad" works fine as well.


8. Open your .sql server file that you just exported in notepad, notepad++ or whatever other text editor you have and use the "Find & Replace" feature (default hotkey is CTRL + H)


9. Now find all DoubleQuotes (") and replace them with backticks (`) and click Replace All, then save it.
[​IMG]


10. Open your mysql.sql example MySQL Database (by default located in the "schemas" folder) with your text editor, and "File" --> "Save As" --> "mysqlCopy.sql" in the same place. Don't close it!
[​IMG]


Now, here comes the tricky part, this is very important to understand!
Each chunk of data is called an SQL Query, that is a command that your SQL server will execute when the file is imported. It starts with an action verb (eg. CREATE, DROP, INSERT) and ends with a semicolon (;).

11. After each SQL Query that creates a table (seen below), you must copy over your INSERT Queries from your SQL database into your MySQL database that insert things (just look at the pics if you don't understand).
[​IMG]


12. Make sure you paste all the INSERT queries after each CREATE TABLE query!
[​IMG]
[​IMG]


13. You can copy & paste as many INSERT queries as you wish, but I would suggest at least copying over all of the;
  • accounts
  • houses
  • players
  • player_depotitems
  • player_items
  • player_skills
  • player_storage
  • tiles
  • tile_items


14. In the CREATE TABLE Query which creates "player_items", reverse cid & pid since MySQL & SQLite stores them differently.
[​IMG]
[​IMG]


15. Go to http://localhost/phpmyadmin/ and import your mysqlCopy.sql file like you would the normal mysql.sql file if you were starting brand new.


16. Host your server!