Error in importing database in MySQL - mysql

I'm trying to import the database in MySQL but it kept on showing this error saying that 'no database selected'. Is there something wrong with my xampp? I've installed xampp v3.0.12.. Does anyone know how to solve this problem? I don't know what to do. :( I need to import this badly.This is the reason why I can't log in to wordpress. dAny help would be very much appreciated! Thanks!
Error
SQL query:
--
-- Database: eucincor_psuccessdb.sql
-- --------------------------------------------------------
-- Table structure for table wp_additional_attendees
CREATE TABLE IF NOT EXISTS `wp_additional_attendees` (
`id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
`attendee_id` INT( 11 ) NOT NULL DEFAULT '0',
`x_attedee_name` VARCHAR( 45 ) DEFAULT NULL ,
`x_attendee_email` VARCHAR( 45 ) DEFAULT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM DEFAULT CHARSET = latin1 AUTO_INCREMENT =1;
MySQL said:
1046 - No database selected

you might would have forgotten to use database.
the dump file does not contain the
create database eucincor_psuccessdb
use eucincor_psuccessdb
either add manually this in the eucincor_psuccessdb.sql file or just type these commands before importing your database.
hope it worked!

Related

1046 No database selected mysql cpanel

how to fix this error when i import database into phpmyadmin cpanel:
SQL query:
--
-- Database: `news_letter`
--
-- --------------------------------------------------------
--
-- Table structure for table `banner_tbl`
--
CREATE TABLE IF NOT EXISTS `banner_tbl` (
`ban_id` INT( 11 ) NOT NULL ,
`banner_img` VARCHAR( 255 ) NOT NULL ,
`date` VARCHAR( 255 ) NOT NULL
) ENGINE = INNODB AUTO_INCREMENT =158 DEFAULT CHARSET = latin1;
MySQL said: Documentation
#1046 - No database selected
add the following lines on top of your .sql file
CREATE DATABASE IF NOT EXISTS `news_letter`;
USE `news_letter`;

I have a *.sql file from MSSQL I am need To import it to MySQL

I have a .sql file from MS-SQL i am trying to import it into MySQL from PHP-My-admin but there showing error for max size i've also change it form php.ini but showing same error. I also tried from command prompt but there also showing error in 21 Line. I pasting here 21 line to 32. how can i do it.
DROP TABLE [dbo].[ACDProcessGradeSheet]
GO
CREATE TABLE [dbo].[ACDProcessGradeSheet] (
[ProcessID] int NOT NULL IDENTITY(1,1) ,
[SessionID] int NULL ,
[ExaminationID] int NULL ,
[IsComplete] bit NULL ,
[CreatedBy] uniqueidentifier NULL ,
[CreatedDate] datetime NULL ,
[ModifiedBy] uniqueidentifier NULL ,
[ModifiedDate] datetime NULL
)
IDENTITY is not a MySQL command. You have to do like this:
CREATE TABLE [dbo].[ACDProcessGradeSheet] (
[ProcessID] int NOT NULL auto_increment ,
... //rest of the fields here
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
I have used InnoDB as engine adn latin as default charset, but you should use the engine and charset that suites your needs.
Also I'm not sure about the brackets. Use none or ` if needed. And uniqueidentifier does not exists in mysql. See this website for a mapping of the MSSQL data types to the MySQL data types: http://dev.mysql.com/doc/workbench/en/wb-migration-database-mssql-typemapping.html

phpmyadmin import database error

I try to import a MySQL database on the localhost through phpmyadmin and i receive this error. what it means? and how can i solve it? any ideas?
SQL query:
--
-- Database: `casasdl_mag`
--
--
-- Database: `casasdl`
--
-- --------------------------------------------------------
--
-- Table structure for table `admin_assert`
--
CREATE TABLE IF NOT EXISTS `admin_assert` (
`assert_id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Assert ID',
`assert_type` VARCHAR( 20 ) DEFAULT NULL COMMENT 'Assert Type',
`assert_data` TEXT COMMENT 'Assert Data',
PRIMARY KEY ( `assert_id` )
) ENGINE = INNODB DEFAULT CHARSET = utf8 COMMENT = 'Admin Assert Table' AUTO_INCREMENT =1;
MySQL said: Documentation
#1046 - No database selected
When you create a table you need to select a database for that table to insert into
USE databaseName;
run this before your script
USE casasdl;
CREATE TABLE IF NOT EXISTS `admin_assert` (
`assert_id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Assert ID',
`assert_type` VARCHAR( 20 ) DEFAULT NULL COMMENT 'Assert Type',
`assert_data` TEXT COMMENT 'Assert Data',
PRIMARY KEY ( `assert_id` )
) ENGINE = INNODB DEFAULT CHARSET = utf8 COMMENT = 'Admin Assert Table' AUTO_INCREMENT =1;
Like you can read in error, you have to select your database.
Add USE yourDatabase; at the beginning of the code.
mysql or each db backend should import your tables into a Database , so it needs you introduce a db name , indeed you should tell to mysql :
use mydbname;
you can create it from :
mysqladmin -uroot -p create mydbname
mysql -uroot -p mydbname < mysqlfile.sql
if you are using external php, then do not use use database syntax or mysql-select_db("database"); syntax. Instead use mysqli_connect which accept database name.
The USE db_name statement tells MySQL to use the db_name database as the default (current) database for subsequent statements. The database remains the default until the end of the session or another USE statement is issued.
Refer: http://dev.mysql.com/doc/refman/5.6/en/use.html
Another option is within phpmyadmin Select DB from the left sidebar and inside it import will work.

Table doesn't exist on CREATE TABLE?

I'm trying to import a SQL dump to another server. It fails on the first line. I'm first creating the exp_actions table and then inserting a bunch of data into it, but I get this really weird error.
SQL query:
--
-- Database: `ee_cmssite`
--
-- --------------------------------------------------------
--
-- Table structure for table `exp_actions`
--
CREATE TABLE `exp_actions` (
`action_id` INT( 4 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
`class` VARCHAR( 50 ) NOT NULL DEFAULT '',
`method` VARCHAR( 50 ) NOT NULL DEFAULT '',
PRIMARY KEY ( `action_id` )
) ENGINE = MYISAM DEFAULT CHARSET = latin1 AUTO_INCREMENT =21;
MySQL said:
#1146 - Table 'site_ee.exp_actions' doesn't exist
Why doesn't it exist? I just instructed it to be created. I'm completely baffled. I've tried with and without IF_NOT_EXISTS
If anyone else comes across this seemingly bizarre error - see https://stackoverflow.com/a/11696069 for the solution.
I had the same symptoms and the cause was the same - moving to a new machine I took the old short-cut of simply copying the databases from the mysql/data directory that I needed directly into the new machine, however some were newer InnoDb types. This causes the Create Table throws table doesn't exist error. I had to drop the database and recreate it, then import from an sql dump.
According to the SQL script, the table exists in another database:
--
-- Database: ee_cmssite
-- --------------------------------------------------------
-- Table structure for table exp_actions
try to use ee_cmssite database instead.
While the error is not clear, I think this is related to the missing USE at the beginning of the file. mysqldump doesn't add a USE statement when you dump a single db. So you should add:
USE `ee_cmssite`;

Error #1046 - No database selected SQL import on XAMPP

I am trying to import the SQL database from my Drupal production site into a sandbox testing site on my local machine. I currently use XAMPP on my machine here at work.
I have downloaded my db aipiadxxm_if9DHdr.sql and then I go to the phpMyAdmin on http://localhost/phpmyadmin/index.php then to -> Import.
After I import the db I get this Error:
SQL query:
--
-- Database: `aipiadxxm_if9DHdr.sql`
--
-- --------------------------------------------------------
--
-- Table structure for table `if9d_access`
--
CREATE TABLE IF NOT EXISTS `if9d_access` (
`aid` int( 11 ) NOT NULL AUTO_INCREMENT ,
`mask` varchar( 255 ) NOT NULL default '',
`type` varchar( 255 ) NOT NULL default '',
`status` tinyint( 4 ) NOT NULL default '0',
PRIMARY KEY ( `aid` )
) ENGINE = MYISAM DEFAULT CHARSET = utf8 AUTO_INCREMENT =1;
MySQL said: Documentation
#1046 - No database selected
What is causing this error message: #1046 - No database selected ?
You need to create and/or select the database on your sandbox machine before importing the SQL for the table structure and data.
In phpMyAdmin, this means choosing a database from the sidebar and then using its import tab. If the database you want to fill doesn't exist, you have to create it first using the Create new database form.
After import, you should confirm that the export-import process hasn't affected the anonymous user record (uid 0).