Questions tagged [mysql-error-1046]

Error #1046 - No database selected

If you get this error:

Error #1046 - No database selected

you need to tell MySQL which database to use:

USE database_name;

or you might need to create a new database:

CREATE DATABASE database_name;
USE database_name;

before launching a command.

16 questions
415
votes
20 answers

Error 1046 No database Selected, how to resolve?

Error SQL query: -- -- Database: `work` -- -- -------------------------------------------------------- -- -- Table structure for table `administrators` -- CREATE TABLE IF NOT EXISTS `administrators` ( `user_id` varchar( 30 ) NOT NULL , `password`…
steph
  • 4,167
  • 2
  • 15
  • 3
27
votes
3 answers

MySQL Trigger: Delete From Table AFTER DELETE

Scope: Two tables. When a new patron is created, they have some information about them stored into a 2nd table (This was done using a trigger as well, it works as expected). Here's an example of my table structure and relationship. Table 1->…
Ohgodwhy
  • 49,779
  • 11
  • 80
  • 110
8
votes
6 answers

Importing using MySQL WorkBench... error ERROR 1046 (3D000)

Scenario: building a RoR enviroment locally for development. Production is on EngineYard / GitHub. All now working ok, except DB isn't importing. I have a .sql file that i've taken from my prod EY site. Now i need to import it to my MySQL locally.…
RedCuber
  • 97
  • 1
  • 3
  • 5
6
votes
3 answers

mySQL 1046 error when importing wordpress database

I'm moving a locally developed wordpress site to a client's server so I'm trying to export the local database and import it to the server. I exported the .sql file according to the instructions here…
HandiworkNYC.com
  • 10,914
  • 25
  • 92
  • 154
4
votes
2 answers

Create procedure ERROR 1046 (3D000): No database selected

I am trying to create a simple procedure which would create a new database. complete code which i am trying to run over mysql is : SET @DB_NAME := "mydb"; SET @DB_CREATE:= "CREATE DATABASE "; DELIMITER // drop procedure if exists create_db…
user2311046
  • 309
  • 1
  • 3
  • 10
2
votes
1 answer

Mysql 1046 error

I've started a new Wordpress site, and and trying to import a database form a site I had about 3 years ago. Whenever I click on import, choose the file and set it away, I get this error: Error SQL query: -- -- Table structure for table…
1
vote
4 answers

How to recover entire backup file to MySql database?

I have a backup mySQL database file which contains a few table structures and a few default records. But when I try to recover to the new database and new system that I just installed, it fails. How can I recover the file 'db' to mysql? $ mysql…
user285594
1
vote
1 answer

Error #1046 while importing a database

Error -- --Database: "wordpress" -- -- -------------------------------------------------------- -- -- Table structure for table "wp_brizy_logs" -- CREATE TABLE "wp_brizy_logs" ( "id" bigint(20) NOT NULL, "type" text NOT NULL, "message" text…
user9992653
1
vote
4 answers

delete rows from a table when a specific row from another table has been deleted

I have Group and each group has contacts associated with it. When a user deletes a group, if the group is not empty then it will alert them that all contacts in that group will be deleted if they continue. Well anyways, so my problem is setting up…
Eli
  • 4,329
  • 6
  • 53
  • 78
0
votes
0 answers

I don't understand how to choose a database in MySQL.(Error 1056)

CREATE TABLE User( id INT PRIMARY KEY, names VARCHAR(100), aling VARCHAR(30), eye VARCHAR(30), hair VARCHAR(30), gender VARCHAR(30), apperences INT, year INT, universal VARCHAR(10) ) everywhere I look, such an…
Evgeni
  • 1
  • 3
0
votes
2 answers

cannot upload large .sql database file to newly installed mysql using mysqldump in windows 7

I've checked through tons of forums and cannot seem to fix this. I need to upload a large database dump file (.sql) to mysql so that I can begin using the database as a key component of a website build project. I've tried various methods and I've…
Eric
  • 1
  • 1
0
votes
0 answers

"use db_name" fails with error #1046 on MySQL, message = "no database selected"

I haven't used MySQL for a while, so forgive me if this is a silly issue with a simple solution. I have checked similar questions on the site, and in the majority of cases, the asker simply forgot to create or specify the database. This is not the…
0
votes
2 answers

A Database Error Occurred Error Number: 1046 in codeigniter

A Database Error Occurred Error Number: 1046 No database selected SELECT * FROM ts_themes WHERE theme_status = 1 Filename: C:/xampp/htdocs/Themeportal/application/models/DatabaseModel.php Line Number: 23
0
votes
1 answer

No database selected. MySQL Query Browser

I am using MySQL Query Browser 1.2.17. My problem is that using EXACTLY the same query sometimes I get No database selected error. I tried to find any dependence in using USE database; or FROM database.table. I have no idea when will I get an error…
holawlo
  • 31
  • 6
0
votes
1 answer

SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected error

my code and I take a error. I wonder how I solve problems
Yusuf Onur Sari
  • 394
  • 2
  • 9
1
2