Execute mysql script file under Linux and prompt No database selected

as mentioned, the environment Linux, executes the .sql file. The purpose of the sql file is to set up several databases and several tables under the database. Part of the code is as follows:

--
-- Current Database: `API_Descriptions`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `api_descriptions` /*!40100 DEFAULT CHARACTER SET latin1 */;

USE `API_Descriptions`;

--
-- Table structure for table `Eclipse`
--

DROP TABLE IF EXISTS `Eclipse`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Eclipse` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `class_url` tinytext CHARACTER SET utf8 NOT NULL,
  `description` text CHARACTER SET utf8 NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1315 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

execute command:

source /home/yding/dataset_fse2014.sql

then prompt for a bunch of: No database selected.
search Baidu, some people say that you need to use [database] first. After using use xxx, all the table files are under the xxx database. It must be wrong.
so, ask for help, how to use sql script to set up the database, thank you!


CREATE DATABASE /*!32312 IF NOT EXISTS*/ `api_descriptions` /*!40100 DEFAULT CHARACTER SET latin1 */;

USE `API_Descriptions`;

the library name is case-sensitive. Try to execute the database name after use in your script again and again with the library name of create database above.

Menu