Olá, estou tendo problemas para importar o arquivo cap2.sql diretamente no cmd, simplesmente baixei o arquivo e inserir o comando -> mysql -u root -p controle_compras < cap2.sql; porém toda vez aparece o erro: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql -u root -p controle_compras < cap2.sql' at line 1.
Eu preciso de usuário e senha para fazer login no mysql e o arquivo cap2.sql não salvei em nenhum lugar específico, ele esta na pasta download.
Podem me ajudar? e também queria saber como exportar os comandos pelo cmd.
Obrigada!
Microsoft Windows [versão 10.0.17134.165]
(c) 2018 Microsoft Corporation. Todos os direitos reservados.
C:\Users\Dyane>mysql -u root -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.12 MySQL Community Server - GPL
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database controle_compras;
Query OK, 1 row affected (0.34 sec)
mysql> use controle_compras;
Database changed
mysql> create table COMPRAS (id int auto_increment primary key, valor double, data date, observacoes varchar(255), recebido boolean);
Query OK, 0 rows affected (0.95 sec)
mysql> insert into COMPRAS (valor, data, observacoes, recebido) values (100.0, '2007-05-12', 'Compras de Maio', true);
Query OK, 1 row affected (0.36 sec)
mysql> select * from COMPRAS;
+----+-------+------------+-----------------+----------+
| id | valor | data | observacoes | recebido |
+----+-------+------------+-----------------+----------+
| 1 | 100 | 2007-05-12 | Compras de Maio | 1 |
+----+-------+------------+-----------------+----------+
1 row in set (0.00 sec)
mysql> mysql -u root -p controle_compras < cap2.sql
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql -u root -p controle_compras < cap2.sql' at line 1
mysql> controle_compras < cap2.sql;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'controle_compras < cap2.sql' at line 1
mysql> mysql -u root -proot controle_compras < cap2.sql;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql -u root -proot controle_compras < cap2.sql' at line 1