SQL - Import data from a file

Asked

Viewed 135 times

0

Hello, friends as they are?

Good I am facing a problem to import a previously created table:

The following return message when I try to import into Mysql:

Static analysis:

3 errors Were found During analysis.

Unexpected Character. (near ":" at position 4)

Unexpected Character. (near ":" at position 25)

Unrecognized statement type. (near "Host" at position 0) SQL command: 'Host: localhost (Version: 5.5.27)

/*!40101 SEP >@OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */

Mysql Messages : Documentation

1064 - 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 'Host: localhost (Version: 5.5.27)

/*!40101 SEP @OLD_CHARACTER_SET_CLIENT=@@C' at line 1"

I would like to know what I can do to ensure that the import is successfully completed.

I’ll be waiting, thank you!

  • 1

    What was the SQL command you used?

  • @Allanandrade I am taking online lessons, I am using EAZY PHP to emulate the local server. So I’m using PHP My Admin to manage MYSQL. I used the administrator import command. I don’t know if I can use a console in EASY PHP.

1 answer

0

I did, I did the following process:

I first created the table: 'cad_client'

After that I clicked SQL and pasted the following code:

CREATE TABLE `cad_cliente` (
  `cd_cliente` int(10) NOT NULL AUTO_INCREMENT,
  `ds_cliente` varchar(255) DEFAULT NULL,
  `nr_cnpjcpf` varchar(50) DEFAULT NULL,
  `nr_ident` varchar(50) DEFAULT NULL,
  `ds_contato` varchar(200) DEFAULT NULL,
  `nr_ddd` char(3) DEFAULT NULL,
  `nr_telefone` varchar(15) DEFAULT NULL,
  `email` varchar(50) DEFAULT NULL,
  `ds_endereco` varchar(50) DEFAULT NULL,
  `ds_complemento` varchar(50) DEFAULT NULL,
  `ds_bairro` varchar(50) DEFAULT NULL,
  `ds_cidade` varchar(50) DEFAULT NULL,
  `ds_estado` varchar(50) DEFAULT NULL,
  `nr_cep` varchar(9) DEFAULT NULL,
  `ds_razao` varchar(100) DEFAULT NULL,
  `tp_cliente` char(1) DEFAULT 'f',
  PRIMARY KEY (`cd_cliente`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;

After creating the tables I pasted the code seginte:

INSERT INTO `cad_cliente` VALUES (16,'spacetec','2222222222222',NULL,'pedro','21','22530548','[email protected]','av rio branco','37 1502','centro','rio de janeiro','RJ','24320000','spacetec soluçoes tecnologicas','j');

Then I created the table 'users'

I clicked SQL and pasted the code below:

CREATE TABLE `usuarios` (
  `usuario_id` int(5) NOT NULL AUTO_INCREMENT,
  `nome` varchar(50) COLLATE latin1_general_ci NOT NULL DEFAULT '',
  `sobrenome` varchar(50) COLLATE latin1_general_ci NOT NULL DEFAULT '',
  `email` varchar(100) COLLATE latin1_general_ci NOT NULL DEFAULT '',
  `usuario` varchar(32) COLLATE latin1_general_ci NOT NULL DEFAULT '',
  `senha` varchar(32) COLLATE latin1_general_ci NOT NULL DEFAULT '',
  `info` text COLLATE latin1_general_ci NOT NULL,
  `nivel_usuario` enum('0','1','2') COLLATE latin1_general_ci NOT NULL DEFAULT '0',
  `data_cadastro` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `data_ultimo_login` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `ativado` enum('0','1') COLLATE latin1_general_ci NOT NULL DEFAULT '0',
  PRIMARY KEY (`usuario_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

I repeated the process of entering the data that was registered in my backup.

So I just separated every part of the process, it worked perfectly.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.