Where are the .sql files stored in windows?

2

I installed MySQL in windows 10 64 bits and I am testing the example databases, download one that they use in an example that I follow, it is called northwind, I do not have it and I download it from the internet, I want to include it so that it appears for me when make show databases; , but I do not know where to place the .sql file that you download. I'm from the console, but I can use the workbench if necessary

    
asked by darioxlz 15.09.2018 в 21:46
source

2 answers

2

From the mysql console you should do the following:

The next command is to first connect to the Manager from the console

mysql -u root -p

later asks for your user's password

******

Once the above is done, execute the command in the following order

SOURCE C:\Users\UsuarioName\Desktop\nombrebasedatos.sql
  

You must write the absolute path of where the location of the   sql file that you try to import, notice that the names of everything   be well written

You should get information similar to the one I show you below in the console

mysql> SOURCE C:\Users\UsuarioName\Desktop\nombrebasedatos.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.05 sec)

Query OK, 1 row affected (0.11 sec)

Database changed
Query OK, 0 rows affected, 1 warning (0.03 sec)

Query OK, 0 rows affected, 1 warning (0.78 sec)

Query OK, 8 rows affected (0.15 sec)
Records: 8  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected, 1 warning (0.05 sec)

Query OK, 0 rows affected, 1 warning (0.69 sec)

Query OK, 0 rows affected, 1 warning (0.06 sec)

Query OK, 0 rows affected, 1 warning (0.48 sec)

Query OK, 0 rows affected, 1 warning (0.05 sec)

Query OK, 0 rows affected, 1 warning (1.43 sec)

Query OK, 91 rows affected (0.18 sec)
Records: 91  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected, 1 warning (0.11 sec)

Query OK, 0 rows affected, 1 warning (0.83 sec)

Query OK, 49 rows affected (0.10 sec)
Records: 49  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected, 1 warning (0.05 sec)

Query OK, 0 rows affected, 1 warning (1.31 sec)

Query OK, 9 rows affected (0.11 sec)
Records: 9  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected, 1 warning (0.24 sec)

Query OK, 0 rows affected, 3 warnings (1.53 sec)

Query OK, 2155 rows affected (2.91 sec)
Records: 2155  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected, 1 warning (0.07 sec)

Query OK, 0 rows affected, 4 warnings (2.38 sec)

Query OK, 376 rows affected (0.85 sec)
Records: 376  Duplicates: 0  Warnings: 0

Query OK, 377 rows affected (0.67 sec)
Records: 377  Duplicates: 0  Warnings: 0

Query OK, 77 rows affected (0.24 sec)
Records: 77  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected, 1 warning (0.04 sec)

Query OK, 0 rows affected, 3 warnings (1.51 sec)

Query OK, 77 rows affected (0.25 sec)
Records: 77  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected, 1 warning (0.09 sec)

Query OK, 0 rows affected, 1 warning (1.15 sec)

Query OK, 4 rows affected (0.20 sec)
Records: 4  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected, 1 warning (0.24 sec)

Query OK, 0 rows affected, 1 warning (1.74 sec)

Query OK, 3 rows affected (0.30 sec)
Records: 3  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected, 1 warning (0.17 sec)

Query OK, 0 rows affected, 1 warning (1.79 sec)

Query OK, 29 rows affected (0.34 sec)
Records: 29  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected, 1 warning (0.09 sec)

Query OK, 0 rows affected, 1 warning (1.10 sec)

Query OK, 53 rows affected (0.41 sec)
Records: 53  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)
    
answered by 15.09.2018 / 22:59
source
2

To load a MySql database that is stored in a text file and be able to use it, it must be imported with an application that allows working with these databases. You can do the import by console, but surely you will want to do things with the BD and these applications make your work much easier. I usually use phpMyAdmin because it's simple. If you need more functions, connections to remote bd, virtualized, etc. it's better MySqlWorkbench .

If you use phpMyAdmin which comes with packages like Xampp , after starting the php + mysql server, in the browser you can open: link you will see the import tab, there you can load your BD.

If you use MySqlWorkbench , open the program. You must create a connection if you have not used it before. You have to start the mysql server and connect. The "Schemas" box with the databases you have for the connection appears on the left. Create a new one for the database to import: click on the fourth button under the menu (if you leave the mouse pointer above it indicates: Create a new schema in the connected server) you indicate the name and click "Apply" opens a window with SQL to create the database, eg CREATE SCHEMA new_schema ; Press "Apply" again. Select the scheme created from the list. In the menu select File / Open Sql Script ... When you load the script it opens the file with the SQL, you select everything (Ctrl + Alt in windows) and execute it, the icon of the lightning bolt above. If the SQL file is correct you must add the tables and data to the created database.

  

Edited:

By the way, I just searched for the BD that you comment: northwind and is a database for SQL server , I think you're not going to be able to use it with mysql.

    
answered by 15.09.2018 в 22:38