dongsimu4422 2014-01-11 14:22
浏览 65
已采纳

尝试将.sql文件导入Cloud SQL时出错

I have uploaded a .sql file that I've exported via phpmyadmin to Google Cloud Storage. When I attempt to import the file to Cloud SQL I get this error...

Failed to import gs://raven-bucket-345/db_raven.sql: mysql_query No database selected (CREATE TABLE IF NOT EXISTS `group` ( `groupID` int(11) NOT NULL AUTO_INCREMENT, `groupName` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `permissions` text COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`groupID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4) An unknown problem occurred (ERROR_RDBMS)

I've tried using the new interface as well as the old one but nothing works... Is there a specific way I am supposed to create the .sql file? I'm just using the default phpmyadmin settings. Any insight into this? Thanks.

UPDATE:It seems the DB name is in there. I've opened the .sql file. Sorry for the formatting. It's just a copy paste from the .sql file. This is the first line:

    -- phpMyAdmin SQL Dump -- version 3.5.1 -- phpmyadmin.net -- Host: localhost -- Generation Time: Jan 11, 2014 at 10:53 PM -- Server version: 5.5.24-log -- PHP Version: 5.4.3 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT /; /!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS /; /!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION /; /!40101 SET NAMES utf8 */; -- 

--
-- Database: `db_raven`
--

-- --------------------------------------------------------

--
-- Table structure for table `curriculum`
--

CREATE TABLE IF NOT EXISTS `curriculum` (
  `curriculumID` int(7) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`curriculumID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Table structure for table `group`

When I try use db_raven; it returns this in the log: Failed to import gs://raven-bucket-345/db_raven2.sql: mysql_query Unknown database 'db_raven' (use db_raven) An unknown problem occurred (ERROR_RDBMS) –

  • 写回答

2条回答 默认 最新

  • doukanzhuo4297 2014-01-11 16:46
    关注

    No database selected : The dump doesn't seem to contain the name of the database to use

    You may need to add this line to the top of db_raven.sql

    USE databasename; #(replace databasename with your db name)

    You should also be about to select the default database using your admin interface

    See Failed to import gs://bucket_name/Cloud.sql

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么