How to create database via sql and utf8_bin?

Asked

Viewed 229 times

0

I have the following sql script:

CREATE TABLE IF NOT EXISTS `pais` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome` varchar(60) DEFAULT NULL,
`sigla` varchar(10) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

INSERT INTO `pais` (`id`, `nome`, `sigla`) VALUES (1, 'Brasil', 'BR');


CREATE TABLE IF NOT EXISTS `estado` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `nome` varchar(75) DEFAULT NULL,
  `uf` varchar(5) DEFAULT NULL,
  `pais` int(7) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_Estado_pais` (`pais`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=28 ;


INSERT INTO `estado` (`id`, `nome`, `uf`, `pais`) VALUES
(1, 'Acre', 'AC', 1),
(2, 'Alagoas', 'AL', 1),
(3, 'Amazonas', 'AM', 1),
(4, 'Amapá', 'AP', 1),
(5, 'Bahia', 'BA', 1),
(6, 'Ceará', 'CE', 1),
(7, 'Distrito Federal', 'DF', 1),
(8, 'Espírito Santo', 'ES', 1),
(9, 'Goiás', 'GO', 1),
(10, 'Maranhão', 'MA', 1),

As you can see, I put CHARSET=utf8 and generates a database with utf8_general_ci. And I need it to be, only utf8_bin. I tried to put, in the script, utf8_bin, but it points syntax error and says that you do not know utf8_bin. Does anyone know how I can do it?

  • Why do you want this?

  • The character setting is UTF-8, the collection (or table) of characters that Mysql uses as default is utf8_general_ci.

  • Which bank?

  • am usandi Mysql

  • But only the bank, because the fields I can make utf8_bin, right?

No answers

Browser other questions tagged

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