0

我想知道这是为什么:backup.sql 文件不被sqlBuddy接受,我已经用 utf8 创建了一个名为 youhand 的数据库

sqlBuddy 消息:

0 statements were executed from the file.
The following errors were reported:
- No database selected
- No database selected
- No database selected
- No database selected
- No database selected
- No database selected
- No database selected
- No database selected
- No database selected
- No database selected

文件内容:

--
-- MySQL 5.0.92
-- Mon, 14 May 2012 18:16:43 +0000
--



    CREATE TABLE `comentarios` (
       `id` int(7) not null auto_increment,
       `texto` varchar(500) not null,
       `id_usuario` int(7) not null,
       `id_receta` int(7) not null,
       `fecha` timestamp not null default CURRENT_TIMESTAMP,
       PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=24;


    CREATE TABLE `etiquetas` (
       `id` int(11) not null auto_increment,
       `nombre` varchar(50) not null,
       `id_usuario` int(7) not null,
       `id_pregunta` int(7) not null,
       `lan` int(3) not null,
       `id_consejo` int(7) not null,
       PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=122;

    CREATE TABLE `familias` (
       `id` int(7) not null auto_increment,
       `clave` varchar(100) not null,
       `pagina` varchar(3000) not null,
       `lan` int(2) not null,
       `id_padre` int(7) not null,
       `id_usuario` int(7) not null,
       PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=11;


    CREATE TABLE `follows` (
       `id` int(11) not null auto_increment,
       `toid` int(11) not null,
       `fromid` int(11) not null,
       PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=43;


    CREATE TABLE `idiomas` (
       `id` int(11) not null auto_increment,
       `lan` varchar(2) not null,
       `nombre` varchar(25) CHARSET utf8 not null,
       `url` varchar(100) not null,
       PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5;

    CREATE TABLE `notificaciones` (
       `id` int(11) not null auto_increment,
       `id_usuario` int(11),
       `id_from` int(11),
       `msj` varchar(1000),
       `tipo` int(2) default '0',
       `id_item` int(11) default '0',
       `leida` int(1) default '0',
       `tipo_actividad` int(2),
       PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2;

    CREATE TABLE `helps` (
       `id` int(11) not null auto_increment,
       `titulo` varchar(100) not null,
       `extra` varchar(3000) not null,
       `id_usuario` int(7) not null,
       `id_cultura` int(7) not null,
       `id_familia` int(7) not null,
       `req` text int(2) not null,
       `req_done` int(2) not null,
       `img_src` varchar(200) not null,
       `fecha` timestamp not null default CURRENT_TIMESTAMP,
       `votos` int(7) not null,
       `lan` int(3) not null,
       PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=63;

    CREATE TABLE `textos` (
       `id` int(7) not null auto_increment,
       `clave` varchar(100) not null,
       `texto` varchar(3000) not null,
       `lengua` int(3) not null,
       `id_usuario` int(7) not null,
       PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=664;

    CREATE TABLE `usuarios` (
       `id` int(7) not null auto_increment,
       `fid` bigint(60) not null,
       `alias` varchar(50) not null,
       `pass` varchar(100) not null,
       `mail` varchar(50) not null,
       `fechar` timestamp not null default CURRENT_TIMESTAMP,
       `ultima` timestamp not null default '0000-00-00 00:00:00',
       `img_src` varchar(200) not null,
       `reputacion` int(11) not null,
       `lan` int(3) not null,
       PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=81;

    CREATE TABLE `votos_item` (
       `id` int(7) not null auto_increment,
       `tipo` int(3) not null,
       `valor` int(2) not null,
       `id_usuario` int(7) not null,
       `id_item` int(7) not null,
       `fecha` timestamp not null default CURRENT_TIMESTAMP,
       PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4;
4

1 回答 1

2

因为它不知道在什么数据库中执行这些语句。

  • 要么以文件开头use youhand;
  • 在每个表名前面放一个数据库名(so CREATE TABLE youhand.familias
  • 或者启动您的应用程序以便选择数据库(命令行参数或通过 GUI)
于 2012-05-15T13:01:48.967 回答