# Importing DB from computer

Discussion in 'System Administration' started by Jon Snow, Feb 8, 2020.

1. ### Jon SnowActive Member

514
72
28
Jun 30, 2017
Ratings:
+114
Local Time:
3:24 AM
Nginx 1.13.9
Not sure if I'm doing something wrong but is this the correct way to import an sql file from my computer into a database on my server?:
Code:
use database;
SOURCE C:\Users\BlahBlah\DB.sql
/ was also used too.

Or is there a better way of doing it? (not importing from a server file)

44,426
10,144
113
May 24, 2014
Brisbane, Australia
Ratings:
+15,696
Local Time:
4:24 PM
Nginx 1.17.x

3,807
369
83
May 31, 2014
Ratings:
+711
Local Time:
9:24 AM
Nginx-1.17.x
Your way is ok but sometimes it may not work...

Another way that always work is:

Create a database from command line or from phpmyadmin as it is easier...

This example path is for Wamp software:
Code:
cd C:\wamp\bin\mysql\mysql5.7.24\bin
mysql.exe -u root -p databasename < database.sql
Then enter the mysql root password and it should work....

4. ### Jon SnowActive Member

514
72
28
Jun 30, 2017
Ratings:
+114
Local Time:
3:24 AM
Nginx 1.13.9
The database can be anywhere. It could be on desktop, documents, downloads, the Users folder I added in my first post. Anywhere that's on the personal computer and not uploaded to the Internet.

That's the normal command I use to import sql files on the server into blank databases. So you're saying that command works with my computer's file paths?
So I'll have to use third-party software to achieve this instead of my own SSH client? I think the method in my first post worked fine in the past but now it's not working, so you'e right about it not working all the time.

3,807
369
83
May 31, 2014
Ratings:
+711
Local Time:
9:24 AM
Nginx-1.17.x
Yes but if mysql is not in the "path" on Windows my example will not work.

What i recommend you is something that i did a few days ago

You can try it and see if it works for you...

You don' need any third-party software for that...

6. ### Jon SnowActive Member

514
72
28
Jun 30, 2017
Ratings:
+114
Local Time:
3:24 AM
Nginx 1.13.9
But wouldn't I have to install wamp (the third-party software)? It isn't default on my computer. Entering "C:\wamp\" to find it returns an error saying it doesn't exist. Or is there another way to do it without wamp?

3,807
369
83
May 31, 2014
Ratings:
+711
Local Time:
9:24 AM
Nginx-1.17.x
As you are trying to import a database.sql file you should use Mysql.

So an installation of it is needed.

Usually most users use something like Wamp or Xampp software that will install Mysql, php and Nginx or Apache...

If yes then find that path of mysql as my example for Wamp and follow my instructions...

If you did something else to install Mysql then maybe you need some other instructions to do it...

Provide some info on how you install Mysql as it may help.. Locate where s the
mysql.exe file and let us know the path..

A command like this should work also:
Code:
C:\path\to\mysql\mysql.exe -u root -p databasename < C:\Users\BlahBlah\DB.sql

Last edited: Feb 8, 2020

44,426
10,144
113
May 24, 2014
Brisbane, Australia
Ratings:
+15,696
Local Time:
4:24 PM
Nginx 1.17.x
only if you have mysql server running on your local computer

9. ### Jon SnowActive Member

514
72
28
Jun 30, 2017
Ratings:
+114
Local Time:
3:24 AM
Nginx 1.13.9
@pamamolf @eva2000 So this is only possible if I have mysql installed on my local machine, is what I'm getting from all of this. I never used Wamp, Xampp or anything to install MySQL to my PC.

44,426
10,144
113
May 24, 2014
Brisbane, Australia
Ratings:
+15,696
Local Time:
4:24 PM
Nginx 1.17.x
yes

what you you trying to do ? import sql database into your Centmin Mod server's MariaDB MySQL server ? if so, upload sql file to your server first and then run import commands.

3,807
369
83
May 31, 2014
Ratings:
+711
Local Time:
9:24 AM
Nginx-1.17.x
Yes you need it... As know it is like trying to open a photoshop .psd file on your computer and you don't have the photoshop Software to handle it ....

You can do it without Xampp or Wamp. It is just easier if you use that kind of software...

514
72
28
Jun 30, 2017
Ratings:
+114
Local Time:
3:24 AM
Nginx 1.13.9