I just want to know if we can create a database .db file from MySQL. If so, how to create .db file? I already knew that, .db file can be created from SQLite and then this .db file can be edited by Qt application.
If we can create .db database from MySQL, can we load and further edit or add data from Qt application?
MySQL needs dozens of files to represent the database plus a server process to interface with those files. There is no such thing as a ".db file" that it can create. The best you can do is a .sql dump that's in the MySQL dialect, but this is pretty much useless without a MySQL server to restore it to.
SQLite is designed as a light-weight library that can interface with a single file that is self-contained. It's expressly made for the purpose you're describing.
If you want to convert from SQLite to MySQL that's possible, but it's not always trivial.
Related
I have multiple tables to create in my current project (each CREATE in its own .sql file) and the order of creation is important, so I'd like one file to create them all in the proper order when I create a new database. This is not a show-stopper, just an inconvenience. In MySQL (using phpMyAdmin) I'd like a single .sql file that will execute multiple other .sql files. I'm looking for something equivalent to Oracle's ability with the "#" sign (or keyword "start"):
#create_users.sql
#create_services.sql
Does MySql/phpMyAdmin have a similar command as Oracle to do this?
The mysql client has a command source that you can put into a .sql file. It reads another .sql file that you name.
This is analogous to the command of the same name in some POSIX shell scripting languages.
You might like to read this manual page to understand other built-in commands of the MySQL client: https://dev.mysql.com/doc/refman/en/mysql-commands.html
Re your comment: You asked in your question above if MySQL/phpMyAdmin has a similar command. MySQL does.
phpMyAdmin is not a product of MySQL, it's an independent community tool, and it does not have a similar command. phpMyAdmin has an import tab, with which you can upload one .sql file at a time.
The .sql files read by phpMyAdmin don't support all the same built-in commands that the command-line mysql client supports. For example, it does not support the source command, because that would require the web application phpMyAdmin to somehow read additional files from your computer. Web applications can't do that (and it's a good thing they can't).
When I do a mysqldump in commmand line, I use the .sql extension to save the file, however, I've installed an auto-backup module on my website and the files are being saved as .mysql automatically. Is this unusual and do I use them the same way, by sourcing them into the database? I.E. Are the suffixes interchangeable?
Edit: Can I source a .mysql file the same way I can source a .sql file?
Background info: I've installed the Backup and Migrate module on Drupal and the backups are creating .mysql files, which I've never seen before.
Please note that I am not asking the difference between MySQL and SQL.
The suffix you use is unimportant whether it's .sql, .mysql, .txt or whatever.
Reason is by default, mysqldump writes information as SQL statements to the standard output.
You can get more details by this.
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
when I go to the database I created in mysql I just see a db.opt, .frm and .ibd file types. Is there a way to create a .mdf database file so I can further create my project in visual studio?
To use a MySQL database in Visual Studio, you need to use Connector / Net and MySQL For Visual Studio. This code works well and will allow you to use MySQL with the various features of VS.
Or you need to transport the data from MySQL to SQL Server. There are tools to do that if you must.
See here. http://dev.mysql.com/tech-resources/articles/mysql-installer-for-windows.html
It is true that some MySQL databases have on-disk structures that use .frm and .ibd files. But those files are intended to be accessed pretty much exclusively by the MySQL server process.
It's also true that the mdf file is an ondisk structure for SQL Server. These files aren't transportable like .xls files or other "document" files.
1) You do NOT want to "extract a MySQL database as an .mdf file". Instead, you want to export a MySQL database to a SQL server database.
2) SQL Server uses any of the following files - at a minimum, you need a "primary database file" and a "log file". But you absolutely need MSSQL to manage these files for you:
.mdf - Primary database data file.
.ndf - Other database data files i.e. non Primary.
.ldf - Log data file.
3) So how do you export? If you're familiar with MSSQL SSMS (the MSSQL GUI), you might want to consider using the Export/Import Wizard. Here is a good "howto" on using MSSQL "import" tools:
http://www.mssqltips.com/sqlservertutorial/2205/mysql-to-sql-server-data-migration/
4) Alternatively, you can also use phpAdmin to "export" into MSSQL:
http://www.waynezim.com/2010/03/how-to-export-mysql-database-to-mssql-using-phpmyadmin/
5) Finally, if all you want to do is access mySQL data from an MSVS C# or ASP.Net program ... there's really no need to export/import at all. .Net allows you to access mySQL data directly:
http://dev.mysql.com/doc/connector-net/en/connector-net-visual-studio.html
Good luck - and let us know what you find works best for you!
Huge mysql noob. Sorry in advance if this is dumb but I have searched around before posting.
I use mysqlimport on a local file to a mysql database that's running on my computer. If I delete the original file that was imported, can I still access the data? If so, where is the data being stored? On some Oracle server?
If it's stored locally, is it stored in a compressed version that takes up less space on my harddrive?
Thanks,
fertileneutrino
if you import a file to a database, it is going to store an instance of that data in the database, so yes, you should still be able to access the data, but why would you want to delete it?
It is being stored in a pool of database files in mySQL, they are referenced when you start mysql...yes the imported doc, is just a .dat file in most cases, as your database file.
When you import the data it is stored in database files on your local machine, using the mysql client program or something like phpmyadmin you should be able to view your imported data.
It's no longer stored in the same format as it was when you first imported it.
you can use something like mysqldump to get the data back out.
http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html