convert mysql to sqlite3 - mysql

I need suggestions on how to create a SQLite database from an old MySQL database using Windows 7. I have MySQL's .FRM and .IDB files, and a SQL File (which I believe to be a dump, not a script, unfortunately). I tried to just use sqlite's .read and got a bunch of syntax errors about lock and unlock, which is why I'm guessing it's a dump file. This is a 30 gig database, so recreating by hand isn't really an option.
Is there any way for me to do something like export to a CSV, then import it into SQLite? I tried to use mysql2sqlite with Cygwin to convert it, and got a ./mysql2sqlite.sh: line 2: $'\r': command not found.
Any ideas?

There is a collection of tools in the official SQLite website.
Wiki Link

Related

secure_file_priv= NULL in mySQL workbench MAC

I am new to mySql workbench and need help importing a large file for analysis. I read here
MySQL workbench table data import wizard extremely slow that the data import wizard shouldn't be used so i used LOAD DATA INFILE as suggested but I had issues importing due to secure_file_priv=NULL.
I found a solution here How should I tackle --secure-file-priv in MySQL? but I don't know how to reset the value of secure_file_priv.
I found some sources that use command line to do so but I don't know how to use mySql workbench from command line.
Any help on how to disable this or change it would be appreciated
don't touch it, it is basicakky a security feature.
use the data import under server in workbench,
If you want do it by sql, ecery thng os written already in How should I tackle --secure-file-priv in MySQL? which you linked
simple
copy your file in the folder, that you get as value, when you do a SHOW VARIABLES LIKE "secure_file_priv";
Now you can make a LOAD DAT ideally from the console, because then you have no timeout.
Read also Bulk insert in the namual so that you can optimize a big data import
If you really want to use any folder which is not recommended, you have to edit the my.ini file for that and restart to server (both can be done in Workbench as well, you see in the picture options file and Start/shutdown.) There are some other ways do restart the service.
Here are the basics good described of importing csv

How can I import MySQL database in neo4j on Windows?

I am continuously looking for a decent tutorial for importing MySQL database in neo4j but I didn't find anyone easily applicable. I am using neo4j version 3.0.3 and MySQL version 8.2.
You can help me any good tutorial or a tool that can dump MySQL database directly into neo4j, but both of them should target Windows OS.
Thank you.
H,
Michael has made such a tool, but I have never used it.
Take a look at this repo : https://github.com/jexp/neo4j-rdbms-import
Usually I make some SQL queries and I save them into a CSV file (#see How to output MySQL query results in CSV format?).
After I load them into Neo4j with the LOAD CSV (#see http://jexp.de/blog/2014/06/load-csv-into-neo4j-quickly-and-successfully/)
Cheers

Migrate script from MySQL 4.0 to 4.1

I've exported a MySQL v4.0.25 script to a sql file and since I can't find an installer for 4.0 anymore the only option left is to use 4.1..
Now, I'm getting the common 1064 error since v4.0 doesn't have utf-8 (only latin-1) and v4.1 gives me a syntax error.
I'd be okay with editing the files manually but, one of the scripts is a file 12GB big and the other one is 5GB so I can't even find an editor able to open a file that large and a problem at hands with this migration (the files are that big because they are a copy of 2 production DBs with over 10years use).
How can I fix or bypass this problem? Any chance I can tell the import script to ignore the lines with errors (and I don't even know how many are there..)?
If it's still possible, dump the data structures in sql and the data tables in csv format using mysqldump --tab=path. This way, any modifications you will need to do will be on the much smaller sql file, keeping the large data files untouched. They you could later import the whole thing using mysqlimport command.
Alternatively, you could always use the mysql --force option for importing your sql file.
More information:
MySQL Reference Manual: mysqldump --tab=path option
MySQL Reference Manual: mysqlimport
MySQL Reference Manual: mysql --force
For manually editing the files:
If you are using Linux as your operating system, then there is a big variety of commands in your hand: more, less, sed, etc. sed is good for substitutions, similar to your question. A nice tutorial can be found at http://www.grymoire.com/Unix/Sed.html
In Windows, I sometimes use PowerShell. I had similar post on StackOverflow about "mysqldump without database name" where there is an example of how to replace a string in a dump file.

SQLite and MySQL, will the conflict?

I just joined a project where they have been using SQLite. I am more comfortable using MySQL with PHPMyAdmin. If I install phpMyAdmin and work with that will it do any damage?
It is a php project. They have alot of code (sloppy code thats so hard to figure out) for accessing a SQLite db. I dont want to effect that but I want to add some new tables to a new db using mysql and phpmyadmin which i am yet to set up because I'm afraid it will break the code written for the SQLite db
.
Are you talking merely about installing PHPMyAdmin to manage a SQLite database? That won't work, since both use completely different API's to be accessible through PHP.
Or do you wish to swap the SQLite database with MySQL and then use PHPMyAdmin to manage the database? That'll work, as long as the project supports both SQLite and MySQL.
Is it a PHP project? Probably not - mysql_-prefixed methods only work with MySQL as far as I know, and SQLite and MySQL don't listen on the same port by default, do they?
You need to work with what is deployed. If the project is using Sqlite, then use that. Databases are not all equal. If you use something different, your code might not even run on the production databases.
first of all, if you don't want affect, create a branch on github then from work this branch ..
you can also dump all table of this sqlite database to a sql file, then import this file to your phpAdmin, will create the table, since this both manager uses sql language ... just remove some ligne of code that are not compatible with mysql on sql file that you dump data from sqlite dabtase .....
here is the code for dump a sqlite database ....
first select the database on terminal on your project director
sqlite3
./open DATABASENAME
.output YOURSQLFILENAME.sql
.dump
.quit
at this stage you already have your database in a sql file
then use php admin to import this file
if it show some error, just try to remove somecode that aren't compatible with mysql on sqlfile.

MySQL 5.0.22 export dump file not importing - syntax errors

I backed up my db with mysqldump from phpMyAdmin. Using MySQL 5.0.22. Made no changes to database file. Import fails. Found many instances of extra spaces using notepad, but now cannot find any other such extraneous spaces. Error is 1064.
Any suggestions on how to import file properly?
Thanks.
I encountered problems with mysql dumps of entire databases including views. So now I dump the tables and data as a separate dump, and export the views, stored routines and functions separately. I restore the tables first then the views etc.
Having come from MS SQL Server and Oracle I would like to know if there are any totally reliable tools out there for MySQL database backups and restores.
You have done several things wrong here
Using PHPMyAdmin for anything critical, especially backups. It is not production-ready, in my experience. Feel free to use it for unimportant read-only work on noncritical servers however.
Editing mysqldump files with notepad (or any other editor). Despite appearances, mysql dump files are not text files and should not be edited with any editor. They contain binary data which is not valid in most character encodings, and therefore can probably not be loaded/saved without introducing errors.
Make a fresh dump using mysqldump, which is the only reliable way of making them, and import that. Do not edit mysql dump files using notepad or any other text tool (this includes the likes of grep, sed etc).
If you need to edit a mysql dump file, then restore it into another (i.e. non-production) database instance, make the necessary changes using SQL commands and re-dump the database. This may be slow but it's reliable.