Import .db file into Msql? - mysql

I am new to hosting website and stuffs, I hosted a forum just for fun on 000webhost.com using an open source forum called Simple Machines Forum (SMF), by the time I setup the forum, I didn't know anything about database and all so I just typed random words like my username, my forum name etc. on "Database name", "Database server" fields. I think I typed my forum's link in "database server" field, so nothing was created on Mysql server and instead a database was created in the root of my website with a file format .db, so I want to import this .db to a proper Mysql server. When I opened this database with notepad++, all my posts, people usernames and file attachments were there. Can I import it?
Please let your answers be noob friendly. :D Thank you.

Sorry, but there is no really noob friendly way to answer this, because it's a complex task.
This database you have is likely in SQLite format. You can try creating a dump of it like this:
sqlite3 your_database.db .dump >dump.sql
And then feed this dump to MySQL using phpMyAdmin or MySQL workbench, or command line. But doing this directly most like won't work because of incompatibilities between SQLite and MySQL. Check out this question for possible solutions for this.

Related

Where can I find my mySQL database (using locate doesn't help)?

First ever Stack Overflow post, thanks for your time. Any constructive criticism on how to post better, please just let me know. I have done a search on my query and have found similar posts, but I was unable to use the information within them to resolve my problem.
I have created a mysql database using the terminal window in my Ubuntu system (which I am also new to, having been a lifelong windows user). I used the following code in the terminal window:
$ mysql -u root -p
Then once in mysql, I did the following
CREATE DATABASE securities_master;
USE securities_master;
I created a user and tables in the database using some other code, that doesn't seem relevant here, so I won't bother posting. However, I then decided I would like to take a look at the tables in the database, so I downloaded an SQLite browser. It was at this point that I realized I could not find my database file.
I tried to find the answer on previous stack overflow posts, and tried the suggestions of:
locate sqlite
locate .db
locate .sqlite
locate securities_master
But unfortunately, none of these showed the file I was looking for. The only place I can think of would be what is called the 'root' directory in my computer, but the Ubuntu file manager system won't let me view it because it says I don't have permissions. Is this where it might be?
Could someone shed some light on where I might be able to find this file/database? I know it is definitely there because if I try to CREATE it again, I get the message that it can't because it already exists.
Thanks again.
sqlite and mysql are two different databases. You can't use sqlite on a mysql database. sqlite is a single-file database, in which users just open the file and read and write to it, while mysql is a more traditional relational database system with a server and a client, where the server manages the database (which is generally in a directory of files), while the client just connects to the server.
Where the mysql database is located my depend on your system, but it's usually in /var/lib/mysql. You can look in /etc/mysql/my.cnf for the configuration file, which should have a datadir option that refers to where the actual data for the database is stored.
You can check my.ini file to see where the data folder is located.
Usually there is a folder {mysqlDirectory}/data
MySQL data storage:
Commands.frm
Commands.myd
Commands.myi
The *.frm files contain the table definitions. Your *.myi files are MyISAM index files. Your *.myd files contain the table data.
as mentioned in the answer before mine, mysql and sqlite are two different systems.
You mention you used the cmd line mysql to create the database and then wanted to view the tables. If you're simply trying to see which table are created, in the same command line you used to Create the database you can run show tables;
If you're after a GUI for this, we'd need a bit more context. Is this ubuntu system a remote server, or are you using the desktop version?
You say you're a long time windows user, If you're using windows locally, I personally like SQLWorkbench for accessing my remote mysql servers.
EDIT: I just re-read your post and realised you're using local ubuntu desktop so me mentioning remote was silly, my bad! However, SQLWorkbench does have a ubuntu version at https://dev.mysql.com/downloads/workbench/

Exporting/importing mysql database with phpmyadmin

i'm migrating my website from a shared hosting to a VPS.
I setup all (files, mail, etc) and now i'm migrating database.
In phpmyadmin I export database to my pc, but when i trying to import database in new host (with phpmyadmin) i have only 12 tables of 47. I tried all avaible options, i tried with compression... I checked also table and these are not correctly populated. In the past i do this operation so many time without problem and i don't understand what can be.
Please can you help me?
I've found that sometimes PHPMyAdmin has issues with large files. This might be corrected by tweaking PHP's settings in php.ini (extend timeout, raise upload_max_filesize), but it may just be easier to upload the sql file to the server and import it via the command line.

Importing a 12gb MySQL database into PHPmyAdmin

SO guys, we had legacy website that has a 12GB MySQL database. We decided to port the legacy website to WordPress and need to import the database into PHPmyAdmin without breaking the database and to implement this in the shortest possible time (although time is not such a critical matter if this can be done painlessly but correctly). So would appreciate if someone can guide me in the right direction and provide detailed instructions.
Thanks guys.
I dont know much but i can recommend to back up you're files befored doing any transfers. If you have a fast internet speed then you guys can try to download the SQL database as a compressed file and dump it into the wordpress new database. The database for mysql should be in your cpanel folder (since all cpanel folders/designs are different it would be best to look up "where to find the msql database on hosting company name's cpanel" and once you find it then you can transfer it whereever is possible)
This is the easiest and most correct way.
mysql -u username -p "dbname" < "path/to/bigdata.sql"
If you have FTP/SSH access, then this is the most probable way.
Upload your .sql via FTP
If you have access to CLI , just run the command above
Normally , this will be fast, but since its 12GB, it might take 30min-1hour depending on server resources.
You can also use other options like this one .
I've already experienced importing 61GB before with just this one-liner.

No tables found in database

I have copied a database from another computer and pasted it in C>XAMPP>MySql>Data of my computer so that I can work with the tables of the database. But I cannot see the tables inside the database. Message shows 'No tables found in database'
I am using phpmyadmin 127.0.0.1 downloaded free from web. I am just a beginner in this field. Please excuse my ignorance and help me in this regard.
If you have your_db.sql file import the database and tables into MySql server using phpmyadmin. You can check here
The approach guaranteed is to Export from the source computer and Import to the destination computer; that is guaranteed and will work perfectly. Try that!
Do this from your phpmyadmin

MySQL Workbench Saving Database

I'm working on a group project and my partner sent me a .mwb file so I could take a look at what they did for the ER diagram, but she can't figure out how to send a .sql file for the database itself (at least I think those are .sql files). How do you save and send a database to someone? I am trying to test the database by writing some queries, but I don't know how to do that if all I can look at is the Diagram. Thanks for any help.
MySQL work bench can definitely do this for you.
here is one link where you have some screenshots too : Back up and restore MySQL databases using MySQL Workbench
It shows how to do both export and import of a database backup.